Closed damiankloip closed 6 years ago
Think my only nit pick would be to use []
instead of array()
but otherwise looks great.
The native CouchDB client supports a headers to be passed in when doing things like replication, so I guess we should support it in CouchDBClient too.
The test fails look to be unrelated, we will need a follow up to fix the test fails.
Added another commit to make the tests run more reliably. Removes the data in the tearDown
method for the functional tests.
Thanks @timmillwood. I didn't add the []
array syntax as it looks like this library doesn't really use that anywhere else yet. I am happy to change if required though.
Related to your comment about couch headers, example replication request body:
{
"source":"test_db_1",
"target":{
"url":"https://my.other-couch.server/test_db_2",
"headers":{
"Authorization":"Bearer TOKEN",
"Other":"Header"
}
}
}
With my last change to the tests we shouldn't create the test DB in the travis config file anymore.
We have a need to set arbitrary headers on requests using the couch client - for our purpose, it's for auth headers, using a Bearer token. This allows another auth server to act as a proxy for the couch database server.
This adds a 'headers' option to the
CouchDBClient
and theAbstractHTTPClient
classes, and implements merging of default headers with passed in headers in the concreteSocketClient
andStreamClient
classes.I added some option handling test coverage for this in
CouchDBClientTest
.