{"action":"opened","issue":{"url":"https://api.github.com/repos/aio-libs/aiohttp/issues/2557","repository_url":"https://api.github.com/repos/aio-libs/aiohttp","labels_url":"https://api.github.com/repos/aio-libs/aiohttp/issues/2557/labels{/name}","comments_url":"https://api.github.com/repos/aio-libs/aiohttp/issues/2557/comments","events_url":"https://api.github.com/repos/aio-libs/aiohttp/issues/2557/events","html_url":"https://github.com/aio-libs/aiohttp/issues/2557","id":276701928,"number":2557,"title":"StreamReaderPayload is broken","user":{"login":"asvetlov","id":356399,"avatar_url":"https://avatars0.githubusercontent.com/u/356399?v=4","gravatar_id":"","url":"https://api.github.com/users/asvetlov","html_url":"https://github.com/asvetlov","followers_url":"https://api.github.com/users/asvetlov/followers","following_url":"https://api.github.com/users/asvetlov/following{/other_user}","gists_url":"https://api.github.com/users/asvetlov/gists{/gist_id}","starred_url":"https://api.github.com/users/asvetlov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asvetlov/subscriptions","organizations_url":"https://api.github.com/users/asvetlov/orgs","repos_url":"https://api.github.com/users/asvetlov/repos","events_url":"https://api.github.com/users/asvetlov/events{/privacy}","received_events_url":"https://api.github.com/users/asvetlov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-24T21:40:13Z","updated_at":"2017-11-24T21:40:13Z","closed_at":null,"author_association":"OWNER","body":"It works for sending data from `request.content` to response like `return web.Response(body=request.content)` but pretty useless for sending data from client HTTP request like\r\n```\r\nasync def test_stream_reader(test_client):\r\n    DATA = b'1234567890' * (2**16)\r\n    async def h1(request):\r\n        return web.Response(body=DATA)\r\n\r\n    async def h2(request):\r\n        async with aiohttp.ClientSession() as sess:\r\n            async with sess.get(client.make_url('/h1')) as resp:\r\n                return web.Response(body=resp.content)\r\n\r\n    app = web.Application()\r\n    app.router.add_get('/h1', h1)\r\n    app.router.add_get('/h2', h2)\r\n\r\n    client = await test_client(app)\r\n    resp = await client.get('/h2')\r\n    assert await resp.read() == DATA\r\n```\r\nObviously `resp.content` from `h2` web handler is closed *before* sending response body.\r\n\r\n`web.Response(body=request.content)` is very rare usage -- usually web site does some processing of request BODY instead of just returning it back to client untouched. \r\n\r\nI doubt if we need this payload writer at all.\r\n\r\n@fafhrd91 ?"}}
{"actor":{"display_login":"asvetlov"}}