Skip to content

Conversation

adrienverge
Copy link
Contributor

"401 Unauthorized" and "403 Forbidden" are two different HTTP errors. CouchDB uses the first one when the server requires authentication credentials, and the second one when the request requires an authorisation that the current user does not have.

For instance, using a validate_doc_update design document can result in "403 Forbidden" being returned. See the official documentation for more details and examples:

// user is not authorized to make the change but may re-authenticate
throw({ unauthorized: 'Error message here.' });
// change is not allowed
throw({ forbidden: 'Error message here.' });

This patch adds Forbidden to the list of HTTP errors raised by couchdb-python.

"401 Unauthorized" and "403 Forbidden" are two different HTTP errors.
CouchDB uses the first one when the server requires authentication
credentials, and the second one when the request requires an
authorisation that the current user does not have.

For instance, using a `validate_doc_update` design document can result
in "403 Forbidden" being returned. See the official documentation [1]
for more details and examples:

  // user is not authorized to make the change but may re-authenticate
  throw({ unauthorized: 'Error message here.' });
  // change is not allowed
  throw({ forbidden: 'Error message here.' });

This patch adds Forbidden to the list of HTTP errors raised by
couchdb-python.

[1]: http://docs.couchdb.org/en/stable/couchapp/ddocs.html#validate-document-update-functions
@djc
Copy link
Owner

djc commented Sep 20, 2016

Good stuff, thanks!

@djc djc merged commit 61b4409 into djc:master Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants