{"action":"created","issue":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/1256","repository_url":"https://api.github.com/repos/rusoto/rusoto","labels_url":"https://api.github.com/repos/rusoto/rusoto/issues/1256/labels{/name}","comments_url":"https://api.github.com/repos/rusoto/rusoto/issues/1256/comments","events_url":"https://api.github.com/repos/rusoto/rusoto/issues/1256/events","html_url":"https://github.com/rusoto/rusoto/issues/1256","id":396024073,"node_id":"MDU6SXNzdWUzOTYwMjQwNzM=","number":1256,"title":"Content-Type of rusoto_sagemaker_runtime::InvokeEndpointInput","user":{"login":"Zebradil","id":1475583,"node_id":"MDQ6VXNlcjE0NzU1ODM=","avatar_url":"https://avatars2.githubusercontent.com/u/1475583?v=4","gravatar_id":"","url":"https://api.github.com/users/Zebradil","html_url":"https://github.com/Zebradil","followers_url":"https://api.github.com/users/Zebradil/followers","following_url":"https://api.github.com/users/Zebradil/following{/other_user}","gists_url":"https://api.github.com/users/Zebradil/gists{/gist_id}","starred_url":"https://api.github.com/users/Zebradil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zebradil/subscriptions","organizations_url":"https://api.github.com/users/Zebradil/orgs","repos_url":"https://api.github.com/users/Zebradil/repos","events_url":"https://api.github.com/users/Zebradil/events{/privacy}","received_events_url":"https://api.github.com/users/Zebradil/received_events","type":"User","site_admin":false},"labels":[{"id":236362902,"node_id":"MDU6TGFiZWwyMzYzNjI5MDI=","url":"https://api.github.com/repos/rusoto/rusoto/labels/bug","name":"bug","color":"fc2929","default":true},{"id":236362905,"node_id":"MDU6TGFiZWwyMzYzNjI5MDU=","url":"https://api.github.com/repos/rusoto/rusoto/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-01-04T18:34:03Z","updated_at":"2019-01-05T11:33:52Z","closed_at":null,"author_association":"NONE","body":"First of all, thanks for the great job!\r\n\r\nI started using rusoto recently and everything is going smooth so far.\r\nHowever, I'm a bit confused of how `InvokeEndpointInput.content_type` field influences an invocation.\r\n\r\nThat's how I build the input instance:\r\n```rust\r\nInvokeEndpointInput {\r\n    accept: Some(\"application/json\".to_owned()),\r\n    body: json.to_string().as_bytes().to_owned(),\r\n    content_type: Some(\"application/json\".to_owned()), // <-- That's it\r\n    endpoint_name: self.endpoint.clone(),\r\n}\r\n```\r\nThat's what I see in logs:\r\n```\r\n-- ship --\r\n 2019-01-04 18:54:51 DEBUG rusoto_core::request              > content-type:\"application/x-amz-json-1.1\"\r\n 2019-01-04 18:54:51 DEBUG rusoto_core::request              > content-type:\"application/json\"\r\n-- snip --\r\n```\r\n\r\nAccording to [this RFC](https://tools.ietf.org/html/rfc7230#section-3.2.2): \r\n> A sender MUST NOT generate multiple header fields with the same field\r\n   name in a message unless either the entire field value for that\r\n   header field is defined as a comma-separated list [i.e., #(values)]\r\n   or the header field is a well-known exception (as noted below).\r\n>\r\n> A recipient MAY combine multiple header fields with the same field\r\n   name into one \"field-name: field-value\" pair, without changing the\r\n   semantics of the message, by appending each subsequent field value to\r\n   the combined field value in order, separated by a comma.\r\n\r\nSo, the actual behavior looks like a bug."},"comment":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/comments/451647874","html_url":"https://github.com/rusoto/rusoto/issues/1256#issuecomment-451647874","issue_url":"https://api.github.com/repos/rusoto/rusoto/issues/1256","id":451647874,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTY0Nzg3NA==","user":{"login":"Zebradil","id":1475583,"node_id":"MDQ6VXNlcjE0NzU1ODM=","avatar_url":"https://avatars2.githubusercontent.com/u/1475583?v=4","gravatar_id":"","url":"https://api.github.com/users/Zebradil","html_url":"https://github.com/Zebradil","followers_url":"https://api.github.com/users/Zebradil/followers","following_url":"https://api.github.com/users/Zebradil/following{/other_user}","gists_url":"https://api.github.com/users/Zebradil/gists{/gist_id}","starred_url":"https://api.github.com/users/Zebradil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zebradil/subscriptions","organizations_url":"https://api.github.com/users/Zebradil/orgs","repos_url":"https://api.github.com/users/Zebradil/repos","events_url":"https://api.github.com/users/Zebradil/events{/privacy}","received_events_url":"https://api.github.com/users/Zebradil/received_events","type":"User","site_admin":false},"created_at":"2019-01-05T11:33:52Z","updated_at":"2019-01-05T11:33:52Z","author_association":"NONE","body":"According that docs `ContentType` is *The MIME type of the input data in the request body.* If a body is just a plain text, this should be specified in the `content-type` header, not in custom attributes.\r\n\r\nIn my particular situation there is a SageMaker endpoint backed with custom docker image. The application inside it (Flask) receives a request with the only `application/x-amz-json-1.1` content-type in any case except `content-type` explicitly specified as something else.\r\n\r\nI still think that the correct solution is to avoid sending default content type header if custom one is defined."}}
{"actor":{"display_login":"Zebradil"}}