{"action":"created","issue":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/928","repository_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/928/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/928/comments","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/928/events","html_url":"https://github.com/spring-cloud/spring-cloud-netflix/issues/928","id":143648314,"number":928,"title":"Feign (Hystrix?) converting GET to POST when using substitutions in headers","user":{"login":"ChrisCurtin","id":3473071,"avatar_url":"https://avatars.githubusercontent.com/u/3473071?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisCurtin","html_url":"https://github.com/ChrisCurtin","followers_url":"https://api.github.com/users/ChrisCurtin/followers","following_url":"https://api.github.com/users/ChrisCurtin/following{/other_user}","gists_url":"https://api.github.com/users/ChrisCurtin/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisCurtin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisCurtin/subscriptions","organizations_url":"https://api.github.com/users/ChrisCurtin/orgs","repos_url":"https://api.github.com/users/ChrisCurtin/repos","events_url":"https://api.github.com/users/ChrisCurtin/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisCurtin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-26T01:48:26Z","updated_at":"2016-03-26T15:43:44Z","closed_at":null,"body":"Hi,\r\n\r\nUsing 1.0.6 and 1.1.0.RC this happens. \r\n\r\nBeen playing with how to set an access token in a header with Feign. Tried lots of options, none of which are satisfactory. \r\n\r\nScenario 1: hardcode the Authorization token in the @RequestMapping header value,  server sees GET with Authorization header, works. Except the token is hardcoded :)\r\n\r\nScenario 2: Pass the Access Token as RequestParam, not working since it isn't a header.\r\n```\r\n@FeignClient(name=\"Location\", url=\"http://localhost:9090\")\r\n\r\npublic interface LocationServiceClient {\r\n    @RequestMapping(method= RequestMethod.GET, value = \"/location/warehouse/{family_name}\")\r\n    WarehouseLocation getLocation(@RequestParam(\"access_token\") String accessToken,\r\n                                  @PathVariable(\"family_name\") String familyName);\r\n}\r\n```\r\n\r\nScenario 3: use @Headers, nothing in the headers at all on the server\r\n\r\n`@Headers(\"Authorization : {access_token}\")`\r\n\r\nScenario 4: change @RequestParam to @Param and Hystrix changes the call to a POST and still no headers. It looks like the access_token is the body of the POST\r\n\r\nScenario 5: Using @Headers change access_token to a @PathParam and same POST problem\r\n\r\nScenario 6: give up on @Headers working, add the headers field to the @RequestMapping. Get the header correctly (!) but still a POST\r\n\r\n```\r\n@FeignClient(name=\"Location\", url=\"http://localhost:9090\")\r\npublic interface LocationServiceClient {\r\n    @RequestMapping(method= RequestMethod.GET, value = \"/location/warehouse/{family_name}\",\r\n   headers = \"Authorization = Bearer {access_token}\")\r\n    @Headers(\"Authorization : {access_token}\")\r\n    WarehouseLocation getLocation(@PathVariable(\"access_token\") String accessToken,\r\n                                  @PathVariable(\"family_name\") String familyName);\r\n}\r\n```\r\n\r\nScenario 7: same as 6, but change @PathVariable to @RequestParameter and get the header, get the GET but the access_token is attached as an URL parameter in addition to being in the header. Except the token is also on the URL now.\r\n\r\nSo it looks like @Headers never seems to work. headers on the @RequestMapping works, but doesn't remove the access_token from the list of values to be sent like family_name is, so Hystrix thinks this is a GET with a payload so changes it to a POST, which the API won't accept (returns 405).\r\n\r\nAny ideas how to pass the access token ONLY as a header?\r\n\r\nThanks\r\n\r\nChris"},"comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/comments/201863812","html_url":"https://github.com/spring-cloud/spring-cloud-netflix/issues/928#issuecomment-201863812","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/928","id":201863812,"user":{"login":"spencergibb","id":594085,"avatar_url":"https://avatars.githubusercontent.com/u/594085?v=3","gravatar_id":"","url":"https://api.github.com/users/spencergibb","html_url":"https://github.com/spencergibb","followers_url":"https://api.github.com/users/spencergibb/followers","following_url":"https://api.github.com/users/spencergibb/following{/other_user}","gists_url":"https://api.github.com/users/spencergibb/gists{/gist_id}","starred_url":"https://api.github.com/users/spencergibb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencergibb/subscriptions","organizations_url":"https://api.github.com/users/spencergibb/orgs","repos_url":"https://api.github.com/users/spencergibb/repos","events_url":"https://api.github.com/users/spencergibb/events{/privacy}","received_events_url":"https://api.github.com/users/spencergibb/received_events","type":"User","site_admin":false},"created_at":"2016-03-26T15:43:44Z","updated_at":"2016-03-26T15:43:44Z","body":"Have you tried a `RequestInterceptor`? Feign changes to a POST when there is a body. I'm away from a computer, what @Header annotation are you using?"}}