mockserver
mockserver copied to clipboard
Invalid "content-encoding" value ".*" is automatically added to the request header
Describe the issue
When I send a POST request to the mock server, it proxy the request to my other service with an extra request header content-encoding: .*
the target service fails because .* is not a valid encoding.
What you are trying to do Simply proxy a request to target service
MockServer version 5.14.0
To Reproduce Steps to reproduce the issue:
- How you are running MockServer (i.e maven plugin, docker, etc) docker with configs below
environment:
MOCKSERVER_LOG_LEVEL: DEBUG
MOCKSERVER_SERVER_PORT: 1080
PROXY_REMOTE_HOST: order
PROXY_REMOTE_PORT: 3000
- Code you used to create expectations
curl -v 'http://localhost:1080/orders' -X POST --data '{}'
- What error you saw Invalid content-encoding value added to the request header, target service fails
Expected behaviour Proxy requests should be exactly the same as the original requests
MockServer Log
order-service-mock | 2022-09-06 05:33:59 5.14.0 INFO 1080 received request:
order-service-mock |
order-service-mock | {
order-service-mock | "method" : "POST",
order-service-mock | "path" : "/orders",
order-service-mock | "headers" : {
order-service-mock | "content-length" : [ "2" ],
order-service-mock | "content-encoding" : [ ".*" ],
order-service-mock | "User-Agent" : [ "curl/7.79.1" ],
order-service-mock | "Host" : [ "localhost:1080" ],
order-service-mock | "Content-Type" : [ "application/x-www-form-urlencoded" ],
order-service-mock | "Accept" : [ "*/*" ]
order-service-mock | },
order-service-mock | "keepAlive" : true,
order-service-mock | "secure" : false,
order-service-mock | "localAddress" : "985a7e517c42/192.168.224.12:1080",
order-service-mock | "remoteAddress" : "192.168.224.1",
order-service-mock | "body" : "{}"
order-service-mock | }
Yes I am having this exact same issue.
My proxied POST calls return :
"faultstring": "Unsupported Encoding \".*\"",
the only work around is to add :
Content-Encoding: ""
to the headers which seems to overwrite the bad value.
obviously this is not a workable solution for testing clients.
Please fix
This seems to be fixed in 5.15.0
- I checked the Changelog - and for me the header is no longer there