jaydoane opened a new pull request #3701: URL: https://github.com/apache/couchdb/pull/3701
<!-- Thank you for your contribution! Please file this form by replacing the Markdown comments with your text. If a section needs no action - remove it. Also remember, that CouchDB uses the Review-Then-Commit (RTC) model of code collaboration. Positive feedback is represented +1 from committers and negative is a -1. The -1 also means veto, and needs to be addressed to proceed. Once there are no objections, the PR can be merged by a CouchDB committer. See: http://couchdb.apache.org/bylaws.html#decisions for more info. --> ## Overview Documentation for design doc update functions specifies that permitted methods are: POST /{db}/_design/{ddoc}/_update/{func} PUT /{db}/_design/{ddoc}/_update/{func}/{docid} [2] But currently anything is accepted, even bogus methods such as in the following example work: ``` $ curl -v -u adm localhost:15984/db-1/_design/ddoc/_update/change -X BOGUS > BOGUS /db-1/_design/bar/_update/change HTTP/1.1 > < HTTP/1.1 200 OK < content-length: 11 < content-type: text/html; charset=utf-8 < * Connection #0 to host localhost left intact Empty World* Closing connection 0 ``` A strict reading of the docs indicates that the null document endpoint only allows POST [1] while the endpoint taking a document id only allows PUT [2]. However, the examples in both cases exclusively use POST, and also PUT doesn't make as much sense from a semantic perspective since a new resource isn't being created, I assume the PUT is a typo, and both should be changed to POST. However, given the inconsistent usage even in CouchDB's own test suite, it seems prudent to minimize incompatibility, while still imposing reasonable restrictions, and allow either PUT or POST for both endpoints. [1] https://docs.couchdb.org/en/latest/api/ddoc/render.html#post--db-_design-ddoc-_update-func [2] https://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid <!-- Please give a short brief for the pull request, what problem it solves or how it makes things better. --> ## Testing recommendations ``` make check ``` <!-- Describe how we can test your changes. Does it provides any behaviour that the end users could notice? --> ## Related Issues or Pull Requests https://github.com/apache/couchdb-documentation/pull/674 <!-- If your changes affects multiple components in different repositories please put links to those issues or pull requests here. --> ## Checklist - [x] Code is written and works correctly - [x] Changes are covered by tests - [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini` - [x] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org