pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

adds content type header "application/javascript; charset=utf-8" to a matched pact's response #14

Closed smckend closed 5 years ago

smckend commented 5 years ago

I'm using this tool to test an application and found from the upgrade from version 0.0.10 to 0.1.0 breaks our tests. After investigating, an exception was thrown due to the RestClient finding a content type of "application/javascript; charset=utf-8" in the response. After doing a verbose curl I could indeed see that the version 0.1.0 of the pact-stub-server adds this content type header along with any headers in the matched pact's response.

madhukar93 commented 5 years ago

+1 caused me a lot of pain. Confirming that explicitly adding the Content-Type header doesn't replace the default header, and the mock server response instead contains the same header twice. Used the 0.1.0 docker image. ngrep output -

T 172.19.0.3:8080 -> 172.19.0.2:44594 [AP]
HTTP/1.1 200 OK.
access-control-allow-origin: *.
content-type: application/javascript; charset=utf-8.
content-type: application/json.
content-length: 72.
date: Tue, 04 Sep 2018 10:12:20 GMT.
uglyog commented 5 years ago

I have released 0.1.1 with this fix