mirror of
https://github.com/python/cpython.git
synced 2025-10-18 04:38:07 +00:00
Issue #18978: A more elegant technique for resolving the method
This commit is contained in:
parent
7dc4f4bbab
commit
aae6a1d76f
1 changed files with 2 additions and 6 deletions
|
@ -321,12 +321,8 @@ class Request:
|
||||||
|
|
||||||
def get_method(self):
|
def get_method(self):
|
||||||
"""Return a string indicating the HTTP request method."""
|
"""Return a string indicating the HTTP request method."""
|
||||||
if getattr(self, 'method', None) is not None:
|
default_method = "POST" if self.data is not None else "GET"
|
||||||
return self.method
|
return getattr(self, 'method', default_method)
|
||||||
elif self.data is not None:
|
|
||||||
return "POST"
|
|
||||||
else:
|
|
||||||
return "GET"
|
|
||||||
|
|
||||||
def get_full_url(self):
|
def get_full_url(self):
|
||||||
return self.full_url
|
return self.full_url
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue