Only attempt to parse the body when it is present.

This commit is contained in:
Thomas E Lackey 2023-01-20 20:08:19 -06:00
parent 190d0d7ac9
commit ade4a7ae91

View File

@ -58,9 +58,11 @@ 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{}
err = json.Unmarshal(body, &result) if len(body) > 0 {
if nil != err { err = json.Unmarshal(body, &result)
return nil, err if 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.