Merge pull request #1331 from bingoohuang/master

log JSON response if httpStatus >= 400
This commit is contained in:
Chris Lu
2020-05-27 21:32:44 -07:00
committed by GitHub

View File

@@ -46,6 +46,12 @@ func writeJson(w http.ResponseWriter, r *http.Request, httpStatus int, obj inter
if err != nil {
return
}
if httpStatus >= 400 {
glog.V(0).Infof("response method:%s URL:%s with httpStatus:%d and JSON:%s",
r.Method, r.URL.String(), httpStatus, string(bytes))
}
callback := r.FormValue("callback")
if callback == "" {
w.Header().Set("Content-Type", "application/json")