我在iriscouch.com上托管了我的沙发实例,并使用CouchRest模型用一个简单的Sinatra应用程序进行了一些测试。
下面是我正在使用的一个简单模型:
class User < CouchRest::Model::Base
property :first_name, String
property :last_name, String
timestamps!
design do
view :by_first_name
end
end我使用以下命令成功地创建了新用户:
User.create(:first_name => "Stonewall", :last_name => "Jackson")执行User.by_first_name.all会导致以下HTTP请求:
http://test_admin:pwd@testytest.iriscouch.com:80/blt/_design/User/_view/by_first_name?include_docs=true&reduce=false
"Accept"=>"application/json"
"Accept-Encoding"=>"gzip, deflate"
"Content-Type"=>"application/json"这是由RestClient通过CouchRest执行的。这没什么问题。
但是当我尝试curl这个网址时,我收到了来自Couch的关于include_docs参数的抱怨:
{"error":"query_parse_error","reason":"Query parameter `include_docs` is invalid for reduce views."}我想知道这是怎么回事。为什么只有在使用curl时,include_docs才是一个问题?
发布于 2012-11-04 02:54:47
一个不同之处在于,您的URL现在包含一个问号。如果不保护shell中的URL,它将被解释为特殊字符。
如果您想要一种更简单的方法来测试您的服务,您可以使用RESTClient而不是curl。
https://stackoverflow.com/questions/11129046
复制相似问题