PATCH Method Handler in Google AppEngine WebApp2

I tried using the def patch(): method in my webapp2.RequestHandler to support partial resource updates, but then I saw that the allowed methods were frozen in webapp2.py:

 allowed_methods = frozenset(('GET', 'POST', 'HEAD', 'OPTIONS', 'PUT', 'DELETE', 'TRACE')) 

How can I extend webapp2.RequestHandler or change the WSGIApplication class to allow the HTTP PATCH method when deployed to Google AppEngine?

+8
google-app-engine webapp2
source share
1 answer

Just use the monkey patch by doing this before creating WSGIApplication :

 allowed_methods = webapp2.WSGIApplication.allowed_methods new_allowed_methods = allowed_methods.union(('PATCH',)) webapp2.WSGIApplication.allowed_methods = new_allowed_methods 

There is a patch in webapp2 , but nobody raised it.

+10
source share

All Articles