I'm hosting my Couch instance on iriscouch.com and doing some testing with a simple Sinatra app, using CouchRest Model.

Here's a simple model I'm using:

class User < CouchRest::Model::Base
  property :first_name, String
  property :last_name, String
  timestamps!

  design do
    view :by_first_name
  end
end

I'm successfully creating new users with:

User.create(:first_name => "Stonewall", :last_name => "Jackson")

Executing User.by_first_name.all results in this HTTP request:

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"

This is executed by RestClient, via CouchRest. No problems there.

But when I try to curlthis URL, I get complaints from Couch about the include_docs parameter:

{"error":"query_parse_error","reason":"Query parameter `include_docs` is invalid for reduce views."}

I'd like to understand what's going on here. Why is include_docsa problem only when using curl?

有帮助吗?

解决方案

One difference is that your URL now contains a question mark. If you don't protect the URL in the shell, it will be interpreted as a special character.

If you want a simpler way to test your services, you can use RESTClient instead of curl.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top