Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Fix request body/POST access#5590
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
rpkilby commentedNov 13, 2017
cc@D3X,@tomchristie. Hi Tom, see my commenthere for context. It seems like setting |
D3X commentedNov 13, 2017
@rpkilby One thing I'm concerned about is that this changes the contract on Normally, Django would set it to an empty With this PR, it gets set to parsed data even for other types, like "application/json". This could result in not-easy-to-track bugs if some middlewares depended on Django's behaviour in this case. |
xordoquy commentedNov 13, 2017
This shouldn't impact middlewares as they are called with Django's request. DRF's views does the wrapping so it's really used "inside" DRF whether core or the application code. |
D3X commentedNov 14, 2017
@xordoquy I wrote a short test to show how the interface on request.POST changes when using DRF and posting JSON:D3X@aa6a4c4 I don't know any app that would break because of it, but it is possible some would. |
7583b3a tofeff4c2Comparefeff4c2 to278cb68Comparerpkilby commentedNov 15, 2017
@D3X - thanks, good catch. |
carltongibson commentedNov 15, 2017
@rpkilby This looks fine to me — I'm inclined to just pull it in, but I'm not quite seeing how the commits match the conversation. (Did you rebase? What changed?)
OK, added, but what wasthis line in the first version? Thanks! |
rpkilby commentedNov 15, 2017
@carltongibson - yeah, I amended the commits from earlier in the conversation. Previously was self._request._post=self._dataself._request._files=self._files |
carltongibson commentedNov 15, 2017
@rpkilby OK, thanks. That makes perfect sense. |
carltongibson left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
xordoquy commentedNov 15, 2017
I have no idea how this PR works. |
rpkilby commentedNov 15, 2017
@xordoquy - it's definitely weird, but it won't reenter. eg, if you call |
* Modernize middleware tests* Added a failing test forencode#5582* Set data ref on underlying django request
This changed as of recent django rest: Seeencode/django-rest-framework#5590
Supersedes/closes#5583 andfixes#5582.