-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow all params to be passed via body for POST _all_docs #2343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In apache/couchdb#2343 the way POST _all_docs works is altered so that the same functionality is available as in GET _all_docs. This commit updates the POST _all_docs documentation to reflect this new behavior.
|
Link to the doc PR: apache/couchdb-documentation#462 |
davisp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Turned out quite a bit simpler than I expected but that parse_body_and_params is reused to good effect.
Couple minor changes to clear up before merging.
src/chttpd/src/chttpd_show.erl
Outdated
| {ok, VDoc} = ddoc_cache:open(DbName, <<"_design/", ViewDesignName/binary>>), | ||
| CB = fun list_cb/2, | ||
| QueryArgs = couch_mrview_http:parse_params(Req, Keys), | ||
| Args = couch_mrview_http:parse_body_and_query(Req, Keys), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd not change the variable name here which will shorten the diff. I assume that was done because its now more than the query string. Though we refer to view reads as queries in multiple places so there's no harm leaving it as QueryArgs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 5f16384
| parse_body_and_query(Req, Props, Keys); | ||
|
|
||
| parse_body_and_query(Req, Keys) -> | ||
| parse_params(chttpd:qs(Req), Keys, #mrargs{keys=Keys, group=undefined, group_level=undefined}, [keep_group_level]). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Project style is to wrap lines at 80 columns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b025b2c
|
Thank you for the review @davisp ! I'll push commits for the changes you've requested soon. |
davisp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
|
Go ahead and squash those fixup commits and then we'll wait for CI to come back. |
This change should allow users to supply all params in POST that can be supplied for GET now. This way we could avoid the ?key="foo" things that would probably cause a lot of pain for users.
As /{db}/_design_docs and /{db}/_local_docs are analogous to _all_docs, this change applies to all three of them.
b025b2c to
7ae4a2f
Compare
Update POST for _all_docs In apache/couchdb#2343 the way POST _all_docs works is altered so that the same functionality is available as in GET _all_docs. This commit updates the POST _all_docs documentation to reflect this new behavior. Co-Authored-By: Jonathan Hall <flimzy@flimzy.com>
Update POST for _all_docs In apache#2343 the way POST _all_docs works is altered so that the same functionality is available as in GET _all_docs. This commit updates the POST _all_docs documentation to reflect this new behavior. Co-Authored-By: Jonathan Hall <flimzy@flimzy.com>
Overview
This change should allow users to supply all params in POST that can be supplied for GET now. This way we could avoid the ?key="foo" things that would probably cause a lot of pain for users.
As
/{db}/_design_docsand/{db}/_local_docsare analogous to_all_docs, this change applies to all three of them.Testing recommendations
Just run the tests included with this PR.
Let me know if you need instructions for manual testing.
Related Issues or Pull Requests
apache/couchdb-documentation#462
Checklist
rel/overlay/etc/default.ini