-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StreamReaderPayload is broken #2557
Comments
Problem is not in StreamReaderPayload but in ClientSession. I think we discussed this in some issue. Main reason was for proxy style endpoints. Actually because of client session you can not do proper streaming processing otherwise StreamReaderPayload should work |
Do you have an evidence of real use case? The problem not in client session but in For proxying the payload is useless: it could be safely applied to |
You can remove it |
* Fix for #2557: Drop StreamReader payload * Add changenote * Drop failed tests
Fixed by #2558 |
@asvetlov I don't see how the "proxy" usecase works now, could you write an exemple? async def handle(request):
async with aiohttp.ClientSession() as sess:
async with sess.put('some external endpoint', data=request.content) as resp:
pass
return web.Response(body=b'ok')
-- The mirrored usage is useful too, for instance an API service that is doing authentication but then forwarding data sent by an external service: async def handle(request):
resp = web.StreamResponse()
await resp.prepare(request)
async with aiohttp.ClientSession() as sess:
async with sess.get('some external endpoint') as external:
await resp.write(external.content)
return resp Here again, the external service could return very large amount of data, or could be streaming data slowly, and exposing properly that to the client is very useful |
@arthurdarcet you are just in time :) |
Perfect, thanks. |
Sure |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
It works for sending data from
request.content
to response likereturn web.Response(body=request.content)
but pretty useless for sending data from client HTTP request likeObviously
resp.content
fromh2
web handler is closed before sending response body.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.I doubt if we need this payload writer at all.
@fafhrd91 what is the use case?
The text was updated successfully, but these errors were encountered: