mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #18978: Allow Request.method to be defined at the class level.
This commit is contained in:
parent
4f7a36f84f
commit
7dc4f4bbab
1 changed files with 3 additions and 2 deletions
|
@ -271,7 +271,8 @@ class Request:
|
||||||
origin_req_host = request_host(self)
|
origin_req_host = request_host(self)
|
||||||
self.origin_req_host = origin_req_host
|
self.origin_req_host = origin_req_host
|
||||||
self.unverifiable = unverifiable
|
self.unverifiable = unverifiable
|
||||||
self.method = method
|
if method:
|
||||||
|
self.method = method
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_url(self):
|
def full_url(self):
|
||||||
|
@ -320,7 +321,7 @@ 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 self.method is not None:
|
if getattr(self, 'method', None) is not None:
|
||||||
return self.method
|
return self.method
|
||||||
elif self.data is not None:
|
elif self.data is not None:
|
||||||
return "POST"
|
return "POST"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue