Conversation
|
@mitsuhiko relevant changes are in |
| _set_request_body(request_info, scope) | ||
|
|
||
|
|
||
| def _set_request_body(request_info, scope): |
There was a problem hiding this comment.
I will have a serious problem with code reuse for the django integration here, that's why I am considering doing it on the wsgi level. But alas Django allegedly sucks for adding custom wsgi middleware anyway, so I'm not sure
|
Instead of doing all this heavy lifting every time we start a request I would propose we register an event processor on the scope instead. It will be invoked before the first exception is thrown in the scope and can then pull data as needed. That also has a smaller chance of screwing up the request state and I think we can get away without doing wrapping on the request stream. |
|
So i mean we have something like this: hub = Hub.get_current()
@hub.add_event_processor
def make_flask_processor():
data = request.form
def processor(event):
event['http']... = data
return processor |
|
@mitsuhiko we can do this but we still need to wrap the data stream upfront like in
what do you mean by this? |
|
I think consuming json/form data by the time someone emits an event is fair. We did it in the past and it did not cause too many concerns. |
|
yes, but if somebody emits an event and the request data is neither json nor form, we would have to access |
|
If I understand correctly you propose accessing |
|
I'm not 100% sure. The thing is that reading from request.stream has side effects obviously so there is a good chance that we will just not do it at all in the Python integrations. So it's just For what it's worth i'm not fully opposed to the solution proposed in the PR right now. I just feel like we might have to put reading from the stream without mimetype check behind an option and then i'm not sure how many people would switch it on. |
|
Note though that the prefix/peek directly read from the stream is not used if it turns out that the data was form or json. In those cases the entire stream is still read and parsed through Flask/Werkzeug. I'll stop posting now. It might well be that I find this PR no longer appealing on Monday |
0237a00 to
3a628b9
Compare
|
closing in favor of #11 |
No description provided.