Skip to content

Commit

Permalink
fix: Improper handling of empty POST requests (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayooot committed Mar 11, 2024
1 parent c0e56c8 commit b3a6f77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jsr311.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (r RouterJSR311) detectRoute(routes []Route, httpRequest *http.Request) (*R
method, length := httpRequest.Method, httpRequest.Header.Get("Content-Length")
if (method == http.MethodPost ||
method == http.MethodPut ||
method == http.MethodPatch) && length == "" {
method == http.MethodPatch) && (length == "" || length == "0") {
return nil, NewError(
http.StatusUnsupportedMediaType,
fmt.Sprintf("415: Unsupported Media Type\n\nAvailable representations: %s", strings.Join(available, ", ")),
Expand Down

0 comments on commit b3a6f77

Please sign in to comment.