{"action":"created","issue":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/462","repository_url":"https://api.github.com/repos/rusoto/rusoto","labels_url":"https://api.github.com/repos/rusoto/rusoto/issues/462/labels{/name}","comments_url":"https://api.github.com/repos/rusoto/rusoto/issues/462/comments","events_url":"https://api.github.com/repos/rusoto/rusoto/issues/462/events","html_url":"https://github.com/rusoto/rusoto/issues/462","id":192749987,"number":462,"title":"HttpResponse assumes String/utf8 body","user":{"login":"blaenk","id":84680,"avatar_url":"https://avatars.githubusercontent.com/u/84680?v=3","gravatar_id":"","url":"https://api.github.com/users/blaenk","html_url":"https://github.com/blaenk","followers_url":"https://api.github.com/users/blaenk/followers","following_url":"https://api.github.com/users/blaenk/following{/other_user}","gists_url":"https://api.github.com/users/blaenk/gists{/gist_id}","starred_url":"https://api.github.com/users/blaenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blaenk/subscriptions","organizations_url":"https://api.github.com/users/blaenk/orgs","repos_url":"https://api.github.com/users/blaenk/repos","events_url":"https://api.github.com/users/blaenk/events{/privacy}","received_events_url":"https://api.github.com/users/blaenk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"matthewkmayer","id":4998189,"avatar_url":"https://avatars.githubusercontent.com/u/4998189?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewkmayer","html_url":"https://github.com/matthewkmayer","followers_url":"https://api.github.com/users/matthewkmayer/followers","following_url":"https://api.github.com/users/matthewkmayer/following{/other_user}","gists_url":"https://api.github.com/users/matthewkmayer/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewkmayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewkmayer/subscriptions","organizations_url":"https://api.github.com/users/matthewkmayer/orgs","repos_url":"https://api.github.com/users/matthewkmayer/repos","events_url":"https://api.github.com/users/matthewkmayer/events{/privacy}","received_events_url":"https://api.github.com/users/matthewkmayer/received_events","type":"User","site_admin":false},"assignees":[{"login":"matthewkmayer","id":4998189,"avatar_url":"https://avatars.githubusercontent.com/u/4998189?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewkmayer","html_url":"https://github.com/matthewkmayer","followers_url":"https://api.github.com/users/matthewkmayer/followers","following_url":"https://api.github.com/users/matthewkmayer/following{/other_user}","gists_url":"https://api.github.com/users/matthewkmayer/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewkmayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewkmayer/subscriptions","organizations_url":"https://api.github.com/users/matthewkmayer/orgs","repos_url":"https://api.github.com/users/matthewkmayer/repos","events_url":"https://api.github.com/users/matthewkmayer/events{/privacy}","received_events_url":"https://api.github.com/users/matthewkmayer/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2016-12-01T04:08:23Z","updated_at":"2016-12-31T21:53:30Z","closed_at":null,"body":"Not sure what to title this. I'm new to AWS and was looking into what it would take to use the Amazon [Ivona TTS](https://www.ivona.com/) service which returns audio data in the response body.\r\n\r\nFrom my experience in using libraries for Ivona in other languages, such as [this one for Go](https://github.com/jpadilla/ivona-go/blob/master/ivona.go#L42), it seems that the request to an Amazon service needs to be signed, so I looked into how I could sign such a request with Rust and came across this nice looking library. Although it doesn't have built-in support for Ivona (and may now be superseded by [AWS Polly](https://aws.amazon.com/blogs/aws/polly-text-to-speech-in-47-voices-and-24-languages/) for inclusion in this library, if it were ever considered), I figured I'd take a shot at issuing and signing the requests manually with the help of this library.\r\n\r\nI came across [`SignedRequest`](http://rusoto.org/rusoto/rusoto/struct.SignedRequest.html) and [`DispatchSignedRequest`](http://rusoto.org/rusoto/rusoto/trait.DispatchSignedRequest.html) which is implemented for Hyper's `Client` type, but I noticed that the response is withered down into a separate [`HttpResponse`](http://rusoto.org/rusoto/rusoto/struct.HttpResponse.html) type that assumes that the response body is a `String`. Perhaps this was done to abstract or hide away the concrete dependency on Hyper, but as far as I can tell it limits what can be done with the response.\r\n\r\nFor example, even if it were correct in its assumption that it's a String, it eagerly and perhaps unnecessarily loads/reads the entire response into a `String`. Imagine a scenario in which the body were to be sent to a consumer (of `io::Read`), then the response body could simply be passed along, whereas the current way unnecessarily reads the entire response body it into a `String` only for one to have to recreate a Read type for it to be passed to the consumer.\r\n\r\nPerhaps I misunderstand, but this could probably mean waiting for the entire body to be read (provided it even fits in memory, hypothetically) before it can be sent to the consumer, whereas if the consumer had access to the Reader to begin with it could immediately start reading whatever is available.\r\n\r\nMy opinion doesn't matter much given that I'm not too familiar with AWS, but perhaps an approach that fully embraced Hyper's `Request` and `Response` would be nice, perhaps by wrapping over them where necessary. It'd be nice if we were able to construct a regular Hyper `Request` the usual way and then sign it using something like `SignedRequest::from(hyperRequest)`, which would essentially perform what the current `SignedRequest::sign()` method does, thereby statically enforcing that any instance of `SignedRequest` is already signed. Then the `HttpResponse` could also contain the Hyper `Response` within it so that users could access the full Hyper `Response`.\r\n\r\nThank you for working on this!"},"comment":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/comments/269883176","html_url":"https://github.com/rusoto/rusoto/issues/462#issuecomment-269883176","issue_url":"https://api.github.com/repos/rusoto/rusoto/issues/462","id":269883176,"user":{"login":"blaenk","id":84680,"avatar_url":"https://avatars.githubusercontent.com/u/84680?v=3","gravatar_id":"","url":"https://api.github.com/users/blaenk","html_url":"https://github.com/blaenk","followers_url":"https://api.github.com/users/blaenk/followers","following_url":"https://api.github.com/users/blaenk/following{/other_user}","gists_url":"https://api.github.com/users/blaenk/gists{/gist_id}","starred_url":"https://api.github.com/users/blaenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blaenk/subscriptions","organizations_url":"https://api.github.com/users/blaenk/orgs","repos_url":"https://api.github.com/users/blaenk/repos","events_url":"https://api.github.com/users/blaenk/events{/privacy}","received_events_url":"https://api.github.com/users/blaenk/received_events","type":"User","site_admin":false},"created_at":"2016-12-31T21:53:29Z","updated_at":"2016-12-31T21:53:29Z","body":"Sounds good, and thanks again for working on this, just brainstorming some ideas."}}
{"actor":{"display_login":"blaenk"}}