Opened 5 years ago

Closed 4 years ago

#17360 closed Cleanup/optimization (fixed)

Documenting differences between Client.post et Client.put

Reported by: thibaultj Owned by: nobody
Component: Documentation Version: master
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 5 years ago.
Same patch as is the pull request
patch_17360.diff (1.7 KB) - added by Zbigniew Siciarz 5 years ago.
Patch updated to reflect raw_post_data renamed to body.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by thibaultj

Same patch as is the pull request

comment:1 Changed 5 years ago by thibaultj

Cc: thibaultj added
Type: UncategorizedCleanup/optimization

comment:2 Changed 5 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

comment:3 Changed 5 years ago by Zbigniew Siciarz

Triage Stage: AcceptedReady for checkin

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

comment:4 Changed 5 years ago by Zbigniew Siciarz

Triage Stage: Ready for checkinAccepted

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

Changed 5 years ago by Zbigniew Siciarz

Attachment: patch_17360.diff added

Patch updated to reflect raw_post_data renamed to body.

comment:5 Changed 5 years ago by Łukasz Rekucki

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.]

Version 0, edited 5 years ago by Łukasz Rekucki (next)

comment:6 Changed 4 years ago by Aymeric Augustin

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