google app engine - dev_appserver.py locally rejects PATCH requests but accepts it on deployed -


text after "itemprop =" text ">

I use an application via djangoappengine, Backbone.js and Django rests the framework based on the PATCH request model update To get a code, call model. Save on {patch: true} .

I've found that when testing locally dev_appserver:

error 2014-02-19 04: 37: 04,531 dev_appserver.py:3081] code 501 , Message unsupported method ('PATCH')

info 2014-02 -19 04: 37: 04,532 dev_appserver.py:3090] "Patch / API / Posts / 5707702298738688 HTTP / 1.1 "501 -

However when I deploy it and the server access through appspot, I accept the request happily, which forces me to deploy every time when I make a change I want to test it Not.

I'm running the latex version (1.89) of Python SDK, and found that it seems to deal with it but it seems.

I tried but it did not make any difference. I do not understand why the development server will refuse them and the production server will not be there, do I need to change?

Thank you.

To update a resource, you can post the patch with the x-http-method-override Can use for This is a valid restructuring operation and POST will be more friendly with firewalls and older user agents. In the request, the data should be indicated whether to update

  at URL = '/ API / Posts / 5707702298738688' var patch_ops = [{"session":. "", "Path": "path": "/ attribute": "author": text} {"op": "add", "path": "/ answers /", {"author": text, "comment" {"Op": "add", "path": "/ a / b /", "blah"}} / * {"Op": "/ remove", "path": "/ a / b / c" C "," value ": {" foo "," bar "]}, {" op ":" substitution "," path ":" / a / b / c "," value ": 42}, {" op "," "/ A / b / d", "path": "/ a / b / c", "path": "/ a / b / d"}, {"op" : "Copy": "/ a / b / e"} * /]; On XHR = jQuery.ajax ({type: "post", beforeSend: function (request) {request.setRequestHeader ("x-HTTP-method-override", "patch");}, URL: that URL, data: my_json_string , Data type: "Jason", success: function (data) {return data;}, error: function (excerpt, textstats, error) {return error;}});  

Server handler:

  def post (auto, object_name): if self.request.headers ['x-http-method-override'] = = 'PATCH': Try the update ('utf-8') according to # patch operation patch_ops_str = self.request.body.decode: except patch_ops = json.loads (new_area_geojson_str): self.response.set_status (400) Return self Response. .response.set_status (405) back to itself. Reponse.out.write ('{"

/ P>


Comments