|
|
@ -29,7 +29,7 @@ This can easily be accomplished with an HTTP middleware:: |
|
|
|
def __call__(self, environ, start_response): |
|
|
|
def __call__(self, environ, start_response): |
|
|
|
method = environ.get('HTTP_X_HTTP_METHOD_OVERRIDE', '').upper() |
|
|
|
method = environ.get('HTTP_X_HTTP_METHOD_OVERRIDE', '').upper() |
|
|
|
if method in self.allowed_methods: |
|
|
|
if method in self.allowed_methods: |
|
|
|
method = method.encode('ascii', 'replace') |
|
|
|
method = method.encode('ascii', 'replace')# Remove this line if you are using Python3. |
|
|
|
environ['REQUEST_METHOD'] = method |
|
|
|
environ['REQUEST_METHOD'] = method |
|
|
|
if method in self.bodyless_methods: |
|
|
|
if method in self.bodyless_methods: |
|
|
|
environ['CONTENT_LENGTH'] = '0' |
|
|
|
environ['CONTENT_LENGTH'] = '0' |
|
|
|