How to set custom header for PouchDB ajax requests?-open source projects pouchdb/pouchdb
I’m using PouchDB 3.2.1. I’m trying to set Authorization
header for all ajax requests:
db.local = new $window.PouchDB(POUCHDB_NAME);
db.remote = new $window.PouchDB(COUCHDB_URI, {
skipSetup: true,
ajax: {
headers: {
'Authorization': 'Basic ' + $window.btoa('admin:admin')
}
}
});
// Replication
db.local.sync(db.remote, {
live : true,
retry: true
});
But it doesn’t works. See the screenshot: