Opened 12 years ago

Closed 11 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)

documenting_restful_testing.diff (1.7 KB ) - added by thibaultj 12 years ago.
Same patch as is the pull request
patch_17360.diff (1.7 KB ) - added by Zbigniew Siciarz 12 years ago.
Patch updated to reflect raw_post_data renamed to body.

Download all attachments as: .zip

Change History (8)

by thibaultj, 12 years ago

Same patch as is the pull request

comment:1 by thibaultj, 12 years ago

Cc: thibaultj added
Type: UncategorizedCleanup/optimization

comment:2 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Zbigniew Siciarz, 12 years ago

Triage Stage: AcceptedReady for checkin

Looking good, applies cleanly against trunk. Marking as ready for checkin.

comment:4 by Zbigniew Siciarz, 12 years ago

Triage Stage: Ready for checkinAccepted

Oh hold on, looks like raw_post_data is deprecated. Gonna fix the patch soon.

by Zbigniew Siciarz, 12 years ago

Attachment: patch_17360.diff added

Patch updated to reflect raw_post_data renamed to body.

comment:5 by Łukasz Rekucki, 12 years ago

Patch needs improvement: set

IMHO, this 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.]

Last edited 12 years ago by Łukasz Rekucki (previous) (diff)

comment:6 by Aymeric Augustin, 11 years ago

Resolution: fixed
Status: newclosed

I fixed that in e73838b6ddcc7b37c03f9eee04fa6e6a283fedb3. This commit also changed the behavior of the test client.

Note: See TracTickets for help on using tickets.
Back to Top