jur9526 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Allow custom request method to show functions #180

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create show function:
function(doc, req){
  return {json: req}
}

2. Try to call it with custom request method (POST, PUT, OPTIONS, etc.)

What is the expected output? What do you see instead?
Expected: use specified request method
Instead: only GET requests are currently implemented

Please provide any additional information below.
Actually, GET methods to show functions are commonly used and this is already 
implemented. However, CouchDB doesn't strict usage of this method and allows to 
use any other request method name: POST, PUT, LOCK, THIS-IS-MY-LOVELY-METHOD 
etc.
Any method name that not in ["GET", "HEAD", "POST", "PUT",
"DELETE", "COPY", "TRACE", "OPTIONS"] list would be represented as list(array) 
of char codes.

Original issue reported on code.google.com by kxepal on 18 May 2011 at 9:04

Attachments:

GoogleCodeExporter commented 9 years ago
What's the use case for supporting anything other than GET? From the wiki:

"Show and list functions are side effect free and idempotent. [...] Their 
purpose is to render JSON documents in other formats."

Original comment by matt.goo...@gmail.com on 22 May 2011 at 10:37

GoogleCodeExporter commented 9 years ago
For example, changed document preview or diff with stored one in nicer form via 
POST request. That's the only use case that I could imagine now(: I've asked 
about this behavior, but got no answer why other methods are supported. May be 
I've done it incorrect. I suppose at least POST one should be supported as far 
as CouchDB allows it.

Original comment by kxepal on 22 May 2011 at 10:50

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub. Please continue discussion here:

https://github.com/djc/couchdb-python/issues/180

Original comment by djc.ochtman on 15 Jul 2014 at 7:21