-
-
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
Memorising of web.Request's read, text, json #250
Conversation
+1 But, please add tests to introduce new behavior explicitly: read |
Also The simplest solution to keep only binary data for now (but if we would to be really smart we may make second layer cache for @fafhrd91 what do you like? |
I have removed internal caching for json and text, since these depend on functions' params (loader, charset). Byte cache seems to be enough for me, while two level cache seems redundant. @asvetlov I have added checks for double calling in simple tests, or it is better to make separate tests? |
-0.5 if your code requires to read same request several times, that is clear indication of architectural problems. i'd raise RuntimeError on second read. |
@fafhrd91 the same behavior is true for ClientResponse - you can |
@fafhrd91 an example - I have REST with some auth key. In my handlers I do smth with request's json, but also I have a decorator that checks auth key from request's json. I want decorator and handler function to be independent. However, in this case header will do it's job better. |
@mind1master [bikeshedding] if you have a REST with some auth key, it should be defined in http headers which are already always available without need to read request payload. And you shouldn't be affected by this issue. [/bikeshedding] |
@kxepal probably you don't get @mind1master reason (while the reason is not fully correct). Let me introduce a realistic scenario. I have REST validators for incoming request. They are use trafaret library for whole JSON body.
Moreover, I like to have generic pagination for incoming request. That can be done by Anyway, I like to have aiohttp client and web API as close as possible. Client caches incoming stream into
Perhaps we need to add |
@fafhrd91 did my the last message change your -0.5 opinion? |
Yes. Make change On Monday, January 19, 2015, Andrew Svetlov notifications@github.com
|
@mind1master please add After the commit (with tests for deprecations and docs update) I'll merge the PR. Thank you, Тоха. |
@asvetlov no, I understand the reasons and +1 for this change. Just @mind1master example was not the best one (; |
@kxepal agreed, I got it after I posted it :) |
Memorising of web.Request's read, text, json
Thanks |
add this change to CHANGES |
Done. @fafhrd91 would you add docs for chunking support for web.Response? I've done it for compression only. Please don't forget |
No description provided.