Only attempt to parse the body when it is present.
This commit is contained in:
parent
190d0d7ac9
commit
ade4a7ae91
@ -58,10 +58,12 @@ func preprocessRequest(r *http.Request) (*http.Request, error) {
|
|||||||
|
|
||||||
// All API requests should be JSON.
|
// All API requests should be JSON.
|
||||||
var result map[string]interface{}
|
var result map[string]interface{}
|
||||||
|
if len(body) > 0 {
|
||||||
err = json.Unmarshal(body, &result)
|
err = json.Unmarshal(body, &result)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pull out the method name, request ID, user ID, and address info.
|
// Pull out the method name, request ID, user ID, and address info.
|
||||||
reqId := fmt.Sprintf("%g", result[jsonReqId])
|
reqId := fmt.Sprintf("%g", result[jsonReqId])
|
||||||
|
Loading…
Reference in New Issue
Block a user