Browse Source
Merge pull request #1331 from bingoohuang/master
log JSON response if httpStatus >= 400
pull/1341/head
Chris Lu
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
0 deletions
-
weed/server/common.go
|
@ -46,6 +46,12 @@ func writeJson(w http.ResponseWriter, r *http.Request, httpStatus int, obj inter |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return |
|
|
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") |
|
|
callback := r.FormValue("callback") |
|
|
if callback == "" { |
|
|
if callback == "" { |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|