Export to GitHub

httplib2 - issue #219

Patch requests are not supported on Google App Engine


Posted on Jul 25, 2012 by Quick Ox

What steps will reproduce the problem? 1. Send an HTTP PATCH request from a Google App Engine application. 2. Get an exception stating that "PATCH" is not supported

What is the expected output? What do you see instead? I would expect httplib2 to intercept the PATCH request and send a POST request instead with a "X-Http-Method-Override: PATCH" header to circumvent this limitation. This won't be needed when this issue is fixed: http://code.google.com/p/googleappengine/issues/detail?id=6316

The attached patch takes a shot at solving this issue.

Attachments

Comment #1

Posted on Jan 2, 2013 by Happy Rhino

Update for a code update:

class AppEngineHttpConnection(httplib.HTTPConnection): ... def request(self, method, url, body=None, headers={}): if method.lower() in UNAUTHORIZED_METHODS: # No side-effects on provided headers. new_headers = {} new_headers.update(headers) new_headers[HTTP_METHOD_OVERRIDE_HEADER] = method method = HTTP_OVERRIDE_METHOD headers = new_headers super(AppEngineHttpConnection, self).request(method, url, body, headers)

since AppEngineHttpConnection now inherits from httplib.HTTPConnection

Status: Assigned

Labels:
Type-Defect Priority-Medium Usability