{"action":"created","issue":{"url":"https://api.github.com/repos/ionrock/cachecontrol/issues/82","repository_url":"https://api.github.com/repos/ionrock/cachecontrol","labels_url":"https://api.github.com/repos/ionrock/cachecontrol/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/ionrock/cachecontrol/issues/82/comments","events_url":"https://api.github.com/repos/ionrock/cachecontrol/issues/82/events","html_url":"https://github.com/ionrock/cachecontrol/pull/82","id":87374281,"number":82,"title":"Ensure chunked responses are cacheable","user":{"login":"bdeeney","id":1282325,"avatar_url":"https://avatars.githubusercontent.com/u/1282325?v=3","gravatar_id":"","url":"https://api.github.com/users/bdeeney","html_url":"https://github.com/bdeeney","followers_url":"https://api.github.com/users/bdeeney/followers","following_url":"https://api.github.com/users/bdeeney/following{/other_user}","gists_url":"https://api.github.com/users/bdeeney/gists{/gist_id}","starred_url":"https://api.github.com/users/bdeeney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdeeney/subscriptions","organizations_url":"https://api.github.com/users/bdeeney/orgs","repos_url":"https://api.github.com/users/bdeeney/repos","events_url":"https://api.github.com/users/bdeeney/events{/privacy}","received_events_url":"https://api.github.com/users/bdeeney/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-11T14:54:59Z","updated_at":"2016-03-23T18:22:58Z","closed_at":"2016-03-23T18:22:58Z","pull_request":{"url":"https://api.github.com/repos/ionrock/cachecontrol/pulls/82","html_url":"https://github.com/ionrock/cachecontrol/pull/82","diff_url":"https://github.com/ionrock/cachecontrol/pull/82.diff","patch_url":"https://github.com/ionrock/cachecontrol/pull/82.patch"},"body":"Proposed patch with covering test case for #81.\r\n\r\nUnfortunately, the newly added [urllib3.response.HTTPResponse.read_chunked()](https://github.com/shazow/urllib3/blob/f21c2a2b73e4256ba2787f8470dbee6872987d2d/urllib3/response.py#L419) method exhausts the response stream by calling `readline()` directly on the CallbackFileWrapper's `fp` attribute.  To ensure the callback is processed after the response stream has been exhausted, this patch registers a response hook on the request.  Not a terribly elegant solution, and I worry about the potential for unintended side effects.  I'd welcome any suggestions for modifying/improving this patch."},"comment":{"url":"https://api.github.com/repos/ionrock/cachecontrol/issues/comments/200478601","html_url":"https://github.com/ionrock/cachecontrol/pull/82#issuecomment-200478601","issue_url":"https://api.github.com/repos/ionrock/cachecontrol/issues/82","id":200478601,"user":{"login":"ionrock","id":509830,"avatar_url":"https://avatars.githubusercontent.com/u/509830?v=3","gravatar_id":"","url":"https://api.github.com/users/ionrock","html_url":"https://github.com/ionrock","followers_url":"https://api.github.com/users/ionrock/followers","following_url":"https://api.github.com/users/ionrock/following{/other_user}","gists_url":"https://api.github.com/users/ionrock/gists{/gist_id}","starred_url":"https://api.github.com/users/ionrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ionrock/subscriptions","organizations_url":"https://api.github.com/users/ionrock/orgs","repos_url":"https://api.github.com/users/ionrock/repos","events_url":"https://api.github.com/users/ionrock/events{/privacy}","received_events_url":"https://api.github.com/users/ionrock/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T18:22:58Z","updated_at":"2016-03-23T18:22:58Z","body":"@bdeeney So, I've gotten around to testing this out and @dstufft is correct that it breaks the use case where the response body is cached even when the response hasn't been used. I'm working on @rmcgibbo's patch #106 instead."}}