{"action":"created","issue":{"url":"https://api.github.com/repos/tomakehurst/wiremock/issues/724","repository_url":"https://api.github.com/repos/tomakehurst/wiremock","labels_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/724/labels{/name}","comments_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/724/comments","events_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/724/events","html_url":"https://github.com/tomakehurst/wiremock/issues/724","id":245380630,"number":724,"title":"Request matching near miss with header Accept-Encoding","user":{"login":"christopheml","id":1050366,"avatar_url":"https://avatars0.githubusercontent.com/u/1050366?v=4","gravatar_id":"","url":"https://api.github.com/users/christopheml","html_url":"https://github.com/christopheml","followers_url":"https://api.github.com/users/christopheml/followers","following_url":"https://api.github.com/users/christopheml/following{/other_user}","gists_url":"https://api.github.com/users/christopheml/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheml/subscriptions","organizations_url":"https://api.github.com/users/christopheml/orgs","repos_url":"https://api.github.com/users/christopheml/repos","events_url":"https://api.github.com/users/christopheml/events{/privacy}","received_events_url":"https://api.github.com/users/christopheml/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-25T12:12:00Z","updated_at":"2017-07-25T16:09:36Z","closed_at":null,"body":"WireMock version : 2.6.0, JUnit rule.\r\n\r\nI'm currently testing a feature in a client application where support for gzip encoding in the response can be switched on or off with a configuration flag. If the flag is enabled, the client sets the Accept-Encoding header to gzip. If the flag is disabled, no Accept-Encoding header is sent.\r\n\r\nWhen I want to test the latter behavior by verifying that the Accept-Encoding header is absent, the test fails stating that the Accept-Encoding header is indeed present and set to \"gzip,deflate\". Upon closer examination through debugging, the underlying client HTTP library makes the request without the header, but when WireMock reconstructs the request for matching purposes, the header is present.\r\n\r\nHere's the body of the test\r\n```java\r\n        stubFor(post(\"/path/to/resource\")\r\n                .willReturn(aResponse()\r\n                        .withStatus(200)\r\n                        .withHeader(\"Content-Type\", \"text/xml\")\r\n                        .withBodyFile(\"response.xml\")));\r\n\r\n       // client making the request\r\n\r\n        verify(postRequestedFor(urlEqualTo(\"/path/to/resource\"))\r\n                .withHeader(\"Accept-Encoding\", absent()))\r\n```\r\n\r\nHere's the output \r\n\r\n```\r\nNo requests exactly matched. Most similar request was:  expected:<\r\nPOST\r\n/path/to/resource\r\nAccept-Encoding: null\r\n> but was:<\r\nPOST\r\n/path/to/resource\r\nAccept-Encoding: gzip,deflate\r\n>\r\n```\r\n\r\nI haven't found out if the behavior is coming from WireMock or the underlying jetty, but it prevents this simple test from working properly."},"comment":{"url":"https://api.github.com/repos/tomakehurst/wiremock/issues/comments/317787915","html_url":"https://github.com/tomakehurst/wiremock/issues/724#issuecomment-317787915","issue_url":"https://api.github.com/repos/tomakehurst/wiremock/issues/724","id":317787915,"user":{"login":"tomakehurst","id":707169,"avatar_url":"https://avatars3.githubusercontent.com/u/707169?v=4","gravatar_id":"","url":"https://api.github.com/users/tomakehurst","html_url":"https://github.com/tomakehurst","followers_url":"https://api.github.com/users/tomakehurst/followers","following_url":"https://api.github.com/users/tomakehurst/following{/other_user}","gists_url":"https://api.github.com/users/tomakehurst/gists{/gist_id}","starred_url":"https://api.github.com/users/tomakehurst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomakehurst/subscriptions","organizations_url":"https://api.github.com/users/tomakehurst/orgs","repos_url":"https://api.github.com/users/tomakehurst/repos","events_url":"https://api.github.com/users/tomakehurst/events{/privacy}","received_events_url":"https://api.github.com/users/tomakehurst/received_events","type":"User","site_admin":false},"created_at":"2017-07-25T16:09:36Z","updated_at":"2017-07-25T16:09:36Z","body":"Could you post the full test case that replicates this?"}}
{"actor":{"display_login":"tomakehurst"}}