You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Main-Method of WireMockServerRunner without any options
If a POST request with an empty payload is sent via a proxy mapping, the “content-length” header is lost. This causes the server to respond with status 411 (“The request must be chunked or have a content length”).
To enable valid POST requests without a body, an empty entity is required.
Otherwise, the proxy request will not include the header content-length.
Additionally, the content-type will only be set if it is already present
in the originalRequest.
This prevents a new, additional header from being set.
Signed-off-by: Christian von Atzigen <christian.vonatzigen@mobi.ch>
To enable valid POST requests without a body, an empty entity is required.
Otherwise, the proxy request will not include the header content-length.
Additionally, the content-type will only be set if it is already present
in the originalRequest.
This prevents a new, additional header from being set.
Signed-off-by: Christian von Atzigen <christian.vonatzigen@mobi.ch>
Signed-off-by: Christian von Atzigen <christian.vonatzigen@mobi.ch>
If a POST request with an empty payload is sent via a proxy mapping, the “content-length” header is lost. This causes the server to respond with status 411 (“The request must be chunked or have a content length”).
Example:
Stub Mapping:
Request:
curl -X POST --location "http://localhost:8080/example/empty-post" -H "Content-Length: 0"
Analysis
There have been several changes which, in my opinion, lead to the behavior.
wiremock/src/main/java/com/github/tomakehurst/wiremock/http/ProxyResponseRenderer.java
Line 219 in 59e8c00
content-length
header-- Issue was "Unsupported Media Type", which usually comes from a “wrong” content-type header.
Proposed solution
wiremock/src/main/java/com/github/tomakehurst/wiremock/http/ProxyResponseRenderer.java
Line 232 in 6728eb7
null
content-length
Header will be set for all requests. (including GET).The text was updated successfully, but these errors were encountered: