File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 21
21
22
22
from .headers import Headers
23
23
from .interfaces import _IFieldStorage , _IXSSSafeFieldStorage
24
+ from .methods import POST , PUT , PATCH , DELETE
24
25
25
26
26
27
class QueryParams (_IXSSSafeFieldStorage ):
@@ -410,8 +411,15 @@ def form_data(self) -> Union[FormData, None]:
410
411
return self ._form_data
411
412
412
413
def json (self ) -> Union [dict , None ]:
413
- """Body of the request, as a JSON-decoded dictionary. Only available for POST requests."""
414
- return json .loads (self .body ) if (self .body and self .method == "POST" ) else None
414
+ """
415
+ Body of the request, as a JSON-decoded dictionary.
416
+ Only available for POST, PUT, PATCH and DELETE requests.
417
+ """
418
+ return (
419
+ json .loads (self .body )
420
+ if (self .body and self .method in (POST , PUT , PATCH , DELETE ))
421
+ else None
422
+ )
415
423
416
424
@property
417
425
def _raw_header_bytes (self ) -> bytes :
You can’t perform that action at this time.
0 commit comments