Skip to content

Commit b3a6f77

Browse files
authored
fix: Improper handling of empty POST requests (#543)
1 parent c0e56c8 commit b3a6f77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsr311.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (r RouterJSR311) detectRoute(routes []Route, httpRequest *http.Request) (*R
155155
method, length := httpRequest.Method, httpRequest.Header.Get("Content-Length")
156156
if (method == http.MethodPost ||
157157
method == http.MethodPut ||
158-
method == http.MethodPatch) && length == "" {
158+
method == http.MethodPatch) && (length == "" || length == "0") {
159159
return nil, NewError(
160160
http.StatusUnsupportedMediaType,
161161
fmt.Sprintf("415: Unsupported Media Type\n\nAvailable representations: %s", strings.Join(available, ", ")),

0 commit comments

Comments
 (0)