Opened 13 years ago
Closed 12 years ago
#17360 closed Cleanup/optimization (fixed)
Documenting differences between Client.post et Client.put
Reported by: | thibaultj | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | rest, put, testing |
Cc: | thibaultj | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description
The testing documentation asserts that « Client.put() […] Acts just like Client.post() except with the PUT request method. ». However, there's a subtle difference in the manner django handles both methods.
When a requests comes with a PUT method, django won't process the request.POST
variable, even if the content is url encoded.
This issue was already reported, but the decision was taken to leave things as this (That was confirmed after this discussion).
However, I think there is a gap in documentation, since a user testing a RESTful web service will meet a WTF!? effect when using a PUT request.
So I tried to make the documentation clearer, by explaining this difference, and explaining the way to overcome the issue.
There is a pull request, but the patch is attached.
Attachments (2)
Change History (8)
by , 13 years ago
Attachment: | documenting_restful_testing.diff added |
---|
comment:1 by , 13 years ago
Cc: | added |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 13 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Looking good, applies cleanly against trunk. Marking as ready for checkin.
comment:4 by , 13 years ago
Triage Stage: | Ready for checkin → Accepted |
---|
Oh hold on, looks like raw_post_data is deprecated. Gonna fix the patch soon.
by , 13 years ago
Attachment: | patch_17360.diff added |
---|
Patch updated to reflect raw_post_data renamed to body.
comment:5 by , 13 years ago
Patch needs improvement: | set |
---|
IMHO, this is only adds to confusion. Saying that it "Acts just like :meth:Client.post
except with the PUT request method" and then showing it doesn't, is not great. Also, the workaround is not really test client specific, so testing docs are probably not the best place for this. We could instead link to proper docs about request.[body/POST/etc.]
comment:6 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I fixed that in e73838b6ddcc7b37c03f9eee04fa6e6a283fedb3. This commit also changed the behavior of the test client.
Same patch as is the pull request