if i do this:
curl -X POST -H 'Content-type: application/xml' -d '<person>...</person>' 'http://0.0.0.0:3000/people/12?_method=PUT'
I get "Only requests to receive, post, and delete are allowed." What for? Rails 2.3.2
This is actually a malfunction in the latest rails. The solution is to pass an HTTP method to override the header with put. Important: the full name of the header is http-x-http-method-override, but rails adds the http prefix, so you should trim this part.
luca , X-Http-Method-Override . _method =, JSON, . curl :
curl -H "X-Http-Method-Override: put" -H "Content-Type: application/json" -d "{\"user\":{\"email\":\"blah@example.com\"}}" www.site.com/users/username.json
, .
-, POST curl, "magic" _method URL-, PUT. , , Rails POST . , .
POST
curl
_method
PUT
( config/routes.rb , POST , .
config/routes.rb
RESTful, , (/people/12), GET, PUT DELETE.
/people/12
GET
DELETE
I would try using curl -X PUTand discarding ?_method=PUTfrom your request.
curl -X PUT
?_method=PUT
Source: https://habr.com/ru/post/1714672/More articles:Given a list of words - what would be a good algorithm to complete a word in java? Trade-offs: speed / efficiency / memory size - javaJSF - Richfaces - How to find out if a session is expiring (on the client) - sessioniPhone: Available Disk Space - iphoneWhere to look for synchronized evidence in java? - javaAggregate function and other columns - sqlWhere is the javadoc log4j trap hiding? - jarUITabBarController UINavigationController Design Advice - iphoneIs there a way to poll a socket in C # only when something is readable? - c #C # protected method overlay implementation interface - inheritanceРазрешение токена метаданных параметра общего типа - reflectionAll Articles