{"action":"created","issue":{"url":"https://api.github.com/repos/square/retrofit/issues/2086","repository_url":"https://api.github.com/repos/square/retrofit","labels_url":"https://api.github.com/repos/square/retrofit/issues/2086/labels{/name}","comments_url":"https://api.github.com/repos/square/retrofit/issues/2086/comments","events_url":"https://api.github.com/repos/square/retrofit/issues/2086/events","html_url":"https://github.com/square/retrofit/issues/2086","id":190170305,"number":2086,"title":"[Feature Request] Add \"returnType\" to requestBodyConverter","user":{"login":"stavfx","id":1842250,"avatar_url":"https://avatars.githubusercontent.com/u/1842250?v=3","gravatar_id":"","url":"https://api.github.com/users/stavfx","html_url":"https://github.com/stavfx","followers_url":"https://api.github.com/users/stavfx/followers","following_url":"https://api.github.com/users/stavfx/following{/other_user}","gists_url":"https://api.github.com/users/stavfx/gists{/gist_id}","starred_url":"https://api.github.com/users/stavfx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stavfx/subscriptions","organizations_url":"https://api.github.com/users/stavfx/orgs","repos_url":"https://api.github.com/users/stavfx/repos","events_url":"https://api.github.com/users/stavfx/events{/privacy}","received_events_url":"https://api.github.com/users/stavfx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-17T21:32:21Z","updated_at":"2016-11-17T23:03:35Z","closed_at":"2016-11-17T23:03:34Z","body":"I'm trying to use Retrofit to communicate with an API that expects unique `Content-Type` and `Accept` headers for every object type that is sent/received.\r\nI've managed to use a Converter to add the correct `Content-Type` according to the `@Body` object. But in order to set the `Accept` header, I need to know what the method is expecting to be returned.\r\nE.g. if this is my code\r\n```\r\n@POST(\"invitation\")\r\nObservable<InvitationResponse> createInvitation(@Body InvitationRequest request);\r\n```\r\nI need to make sure the `Accept` header is set to `application/invitation_response+json`.\r\n\r\nOf course this can be done with custom annotations, but I don't want to declare the expected return type is `InvitationResponse` twice.\r\n\r\nMaybe there's a way I missed to achieve this without complicating the definition, but adding the \"returnType\" to Converter.Factory.requestBodyConverter() would allow me to solve this in a similar manner to how I handled `Content-Type`."},"comment":{"url":"https://api.github.com/repos/square/retrofit/issues/comments/261398059","html_url":"https://github.com/square/retrofit/issues/2086#issuecomment-261398059","issue_url":"https://api.github.com/repos/square/retrofit/issues/2086","id":261398059,"user":{"login":"stavfx","id":1842250,"avatar_url":"https://avatars.githubusercontent.com/u/1842250?v=3","gravatar_id":"","url":"https://api.github.com/users/stavfx","html_url":"https://github.com/stavfx","followers_url":"https://api.github.com/users/stavfx/followers","following_url":"https://api.github.com/users/stavfx/following{/other_user}","gists_url":"https://api.github.com/users/stavfx/gists{/gist_id}","starred_url":"https://api.github.com/users/stavfx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stavfx/subscriptions","organizations_url":"https://api.github.com/users/stavfx/orgs","repos_url":"https://api.github.com/users/stavfx/repos","events_url":"https://api.github.com/users/stavfx/events{/privacy}","received_events_url":"https://api.github.com/users/stavfx/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T23:03:34Z","updated_at":"2016-11-17T23:03:34Z","body":"Yes, I realize this is a very specific case.\r\nI also noticed that the way I was able to \"set the Content-Type header\" was actually by using `RequestBody.create(MEDIA_TYPE, body)` which won't be applicable to other headers, like you said.\r\nI guess I'll keep using the `@Header/@Headers` annotations, thanks :)"}}
{"actor":{"display_login":"stavfx"}}