couchdb
couchdb copied to clipboard
API versioning
Overview
This PR implements a draft of proposal
Testing recommendations
Running make check
should be sufficient. You might need to comment out the following line because elixir tests are failing for prototype/fdb-layer
.
You also can run API version related test suite alone as follows exunit tests=src/chttpd/test/exunit/api_version_test.exs
The manual testing can be done using the following:
curl -u adm:pass "http://127.0.0.1:15984/_all_dbs"
["_users","test"]
curl -u adm:pass "http://127.0.0.1:15984/_all_dbs" -H "X-Couch-API: 1"
["_users","test"]
curl -u adm:pass "http://127.0.0.1:15984/_v1/_all_dbs"
["_users","test"]
curl -u adm:pass "http://127.0.0.1:15984/_all_dbs" -H "Accept: application/couchdb; _v=1,application/json"
["_users","test"]
curl -u adm:pass "http://127.0.0.1:15984/_all_dbs" -H "X-Couch-API: 2"
{"bookmark":"123456","items":["foo","bar","baz"]}
curl -u adm:pass "http://127.0.0.1:15984/_v2/_all_dbs"
{"bookmark":"123456","items":["foo","bar","baz"]}
curl -u adm:pass "http://127.0.0.1:15984/_all_dbs" -H "Accept: application/couchdb; _v=2,application/json"
{"bookmark":"123456","items":["foo","bar","baz"]}
Related Issues or Pull Requests
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
- [ ] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation
I refactored PR to parse Version earlier and added tests
Do we want this in 3.2
or do we intend to add the version option in >3.x
onwards?
There were no consensus https://lists.apache.org/thread.html/rcc742c0fdca0363bb338b54526045720868597ea35ee6842aef174e0%40%3Cdev.couchdb.apache.org%3E.
However Adam started new discussion about it recently https://github.com/apache/couchdb/blob/main/src/chttpd/src/chttpd_httpd_handlers.erl#L62:L495