Created
July 28, 2012 19:55
-
-
Save jacobian/3194551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PatchMethodOverrideMiddleware(object): | |
""" | |
Support X-HTTP-Method-Override: PATCH. | |
This isn't 100% support, since it's just here to work around ELB | |
not supporting PATCH. So this only allows "converting" POST to PATCH. | |
""" | |
def process_request(self, request): | |
if request.method == 'POST': | |
override = request.META.pop('HTTP_X_HTTP_METHOD_OVERRIDE', '') | |
if override.upper() == 'PATCH': | |
request.method = 'PATCH' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment