shouldParseBody determines whether the incoming HTTP method is expected to carry a request body that should be parsed.
(method string)
| 47 | // shouldParseBody determines whether the incoming HTTP method |
| 48 | // is expected to carry a request body that should be parsed. |
| 49 | func shouldParseBody(method string) bool { |
| 50 | switch method { |
| 51 | case http.MethodPost, http.MethodPut, http.MethodPatch: |
| 52 | return true |
| 53 | default: |
| 54 | return false |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // ReadBody reads the request body into a byte slice. |
| 59 | // Users can customize the ReadBody function. |