Prevent PUT requests to list resources.
Review Request #13284 — Created Sept. 22, 2023 and submitted
We've had a long-standing bug in the API where making a PUT request to a
list resource would generally cause a crash (depending on the particular
implementation of the resource'supdate
method, most of which end up
trying to callget_object
without the necessary object key in the
kwargs).This change makes it so that attempting to PUT to a list resource will
fail with an HTTP 405. We had a similar implementation for POST to item
resources, so this implementation is based on that.
- Did a PUT to a list resource and saw that I got back an HTTP 405
(method not allowed) instead of a 500 and HTML error content. - Ran unit tests.
- Updated Review Board unit tests to test this functionality for all
list resources.
Summary | ID |
---|---|
763b2063e8b6a7754e0f5ada1f8841e4ff5d7b70 |
Description | From | Last Updated |
---|---|---|
Can you update Djblets unit tests for these conditions? |
|
|
local variable 'response' is assigned to but never used Column: 9 Error code: F841 |
![]() |
|
statement ends with a semicolon Column: 51 Error code: E703 |
![]() |
|
local variable 'response' is assigned to but never used Column: 9 Error code: F841 |
![]() |
|
local variable 'response' is assigned to but never used Column: 9 Error code: F841 |
![]() |
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+66 -4) |
Checks run (2 succeeded)
Change Summary:
Add more tests.
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+164 -4) |
Checks run (1 failed, 1 succeeded)
flake8
-
djblets/webapi/tests/test_webapiresource.py (Diff revision 3) local variable 'response' is assigned to but never used Column: 9 Error code: F841
-
djblets/webapi/tests/test_webapiresource.py (Diff revision 3) statement ends with a semicolon Column: 51 Error code: E703
-
djblets/webapi/tests/test_webapiresource.py (Diff revision 3) local variable 'response' is assigned to but never used Column: 9 Error code: F841
-
djblets/webapi/tests/test_webapiresource.py (Diff revision 3) local variable 'response' is assigned to but never used Column: 9 Error code: F841
Commits: |
|
|||||||
---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+164 -4) |