我正在尝试使用ruby框架Ramaze来实现一个RESTful控制器。但是,当我发送PUT时,似乎无法访问请求中的数据。示例代码:
require 'ramaze'
class PutController < Ramaze::Controller
map '/'
def index
"Argument of "+request[:id]
end
end
Ramaze.start以及我通过curl与它进行交互:
% curl -d id=5 "http://localhost:7000/"
Argument of 5
% curl -v -X PUT -d id=5 "http://localhost:7000/" > /dev/null
...
HTTP/1.1 500 Internal Server Error
[With a backtrace revealing that the request object is nil]我做错了什么吗?在Ramaze中,我应该如何理解PUT请求的正文?
发布于 2009-07-08 20:36:00
试试这个:
require 'rubygems'
require 'ramaze'
class PutController < Ramaze::Controller
map '/'
def index
"Argument of "+request.POST['id']
end
end
Ramaze.start它适用于PUT以及POST和GET。
https://stackoverflow.com/questions/1095077
复制相似问题