My favorites | Sign in
Project Home
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 180: Allow custom request method to show functions
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----

Sign in to add a comment
Reported by kxepal, May 18, 2011
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.
537 bytes   View   Download
1.4 KB   View   Download
May 22, 2011
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."
May 22, 2011
#2 kxepal
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.
Jul 15, 2014
Project Member #3 djc.ochtman
This issue has been migrated to GitHub. Please continue discussion here:
Sign in to add a comment

Powered by Google Project Hosting