You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Erick Johnson <ej...@gmail.com> on 2010/05/28 04:50:11 UTC

querying view info with a GET request returns 405 "only [... GET...] allowed"

This is just an FYI on a very minor bug...
I was trying to query for view info as described here:

http://wiki.apache.org/couchdb/HTTP_view_API?action=show&redirect=HttpViewApi#Getting_Information_about_Design_Documents_.28and_their_Views.29

I boned the URL the first time and accidentally requested the path:
     /stream/_design/stream/_view/mpeg_genres/_info
instead of:
     /stream/_design/stream/_info

The problem is that the response that came back didn't make any
sense.  It responded with a 405 method_not_allowed rather than
something like a 404.  I only bring it up because it led to a short
headache thinking my GET request wasn't actually being seen as
a GET somehow.

Detailed info below...

 >>> Couchdb Version 0.11.0 >>>

$ ./couchdb -V
couchdb - Apache CouchDB 0.11.0

 >>> From the server logs >>>

[debug] [<0.13161.1>] 'GET' 
/stream/_design/stream/_view/mpeg_genres/_info {1,1}
Headers: [{'Accept',"*/*"},
           {'Authorization',"Basic ZXJpY2s6Zm9vYmFy"},
           {'Host',"localhost:5984"},
           {'User-Agent',"curl/7.19.4 (universal-apple-darwin10.0) 
libcurl/7.19.4 OpenSSL/0.9.8l zlib/1.2.3"}]
[debug] [<0.13161.1>] OAuth Params: []
[info] [<0.13161.1>] 127.0.0.40 - - 'GET' 
/stream/_design/stream/_view/mpeg_genres/_info 405
[debug] [<0.13161.1>] httpd 405 error response:
  {"error":"method_not_allowed","reason":"Only GET,POST,HEAD allowed"}

 >>> From the client side >>>

$ curl -vX GET 
http://erick:foobar@localhost:5984/stream/_design/stream/_view/mpeg_genres/_info
* About to connect() to localhost port 5984 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 5984 (#0)
* Server auth using Basic with user 'erick'
 > GET /stream/_design/stream/_view/mpeg_genres/_info HTTP/1.1
 > Authorization: Basic ZXJpY2s6Zm9vYmFy
 > User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 
OpenSSL/0.9.8l zlib/1.2.3
 > Host: localhost:5984
 > Accept: */*
 >
< HTTP/1.1 405 Method Not Allowed
< Server: CouchDB/0.11.0 (Erlang OTP/R13B)
< Date: Fri, 28 May 2010 02:36:36 GMT
< Content-Type: text/plain;charset=utf-8
< Content-Length: 69
< Cache-Control: must-revalidate
< Allow: GET,POST,HEAD
<
{"error":"method_not_allowed","reason":"Only GET,POST,HEAD allowed"}
* Connection #0 to host localhost left intact
* Closing connection #0

Re: querying view info with a GET request returns 405 "only [... GET...] allowed"

Posted by Jan Lehnardt <ja...@apache.org>.
Hi Erick,

Can you submit a report at http://issues.apache.org/jira/browse/COUCHDB so we don't lose track?

Bonus points for a test-case in form of a patch to the JavaScript test suite :)

Cheers
Jan
-- 

On 28 May 2010, at 04:50, Erick Johnson wrote:

> This is just an FYI on a very minor bug...
> I was trying to query for view info as described here:
> 
> http://wiki.apache.org/couchdb/HTTP_view_API?action=show&redirect=HttpViewApi#Getting_Information_about_Design_Documents_.28and_their_Views.29
> 
> I boned the URL the first time and accidentally requested the path:
>    /stream/_design/stream/_view/mpeg_genres/_info
> instead of:
>    /stream/_design/stream/_info
> 
> The problem is that the response that came back didn't make any
> sense.  It responded with a 405 method_not_allowed rather than
> something like a 404.  I only bring it up because it led to a short
> headache thinking my GET request wasn't actually being seen as
> a GET somehow.
> 
> Detailed info below...
> 
> >>> Couchdb Version 0.11.0 >>>
> 
> $ ./couchdb -V
> couchdb - Apache CouchDB 0.11.0
> 
> >>> From the server logs >>>
> 
> [debug] [<0.13161.1>] 'GET' /stream/_design/stream/_view/mpeg_genres/_info {1,1}
> Headers: [{'Accept',"*/*"},
>          {'Authorization',"Basic ZXJpY2s6Zm9vYmFy"},
>          {'Host',"localhost:5984"},
>          {'User-Agent',"curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8l zlib/1.2.3"}]
> [debug] [<0.13161.1>] OAuth Params: []
> [info] [<0.13161.1>] 127.0.0.40 - - 'GET' /stream/_design/stream/_view/mpeg_genres/_info 405
> [debug] [<0.13161.1>] httpd 405 error response:
> {"error":"method_not_allowed","reason":"Only GET,POST,HEAD allowed"}
> 
> >>> From the client side >>>
> 
> $ curl -vX GET http://erick:foobar@localhost:5984/stream/_design/stream/_view/mpeg_genres/_info
> * About to connect() to localhost port 5984 (#0)
> *   Trying ::1... connected
> * Connected to localhost (::1) port 5984 (#0)
> * Server auth using Basic with user 'erick'
> > GET /stream/_design/stream/_view/mpeg_genres/_info HTTP/1.1
> > Authorization: Basic ZXJpY2s6Zm9vYmFy
> > User-Agent: curl/7.19.4 (universal-apple-darwin10.0) libcurl/7.19.4 OpenSSL/0.9.8l zlib/1.2.3
> > Host: localhost:5984
> > Accept: */*
> >
> < HTTP/1.1 405 Method Not Allowed
> < Server: CouchDB/0.11.0 (Erlang OTP/R13B)
> < Date: Fri, 28 May 2010 02:36:36 GMT
> < Content-Type: text/plain;charset=utf-8
> < Content-Length: 69
> < Cache-Control: must-revalidate
> < Allow: GET,POST,HEAD
> <
> {"error":"method_not_allowed","reason":"Only GET,POST,HEAD allowed"}
> * Connection #0 to host localhost left intact
> * Closing connection #0