add support for http basic auth (#1706)

* add support for http basic auth

* update http auth per flovilmart feedback
This commit is contained in:
Hussam Moqhim
2016-05-18 22:06:37 -05:00
committed by Drew
parent 4d4361451c
commit 03108e6347
2 changed files with 71 additions and 0 deletions

View File

@@ -12,6 +12,30 @@ describe('server', () => {
expect(setServerConfiguration.bind(undefined, { appId: 'myId', masterKey: 'mk' })).toThrow('You must provide a serverURL!');
done();
});
it('support http basic authentication with masterkey', done => {
request.get({
url: 'http://localhost:8378/1/classes/TestObject',
headers: {
'Authorization': 'Basic ' + new Buffer('test:' + 'test').toString('base64')
}
}, (error, response, body) => {
expect(response.statusCode).toEqual(200);
done();
});
});
it('support http basic authentication with javascriptKey', done => {
request.get({
url: 'http://localhost:8378/1/classes/TestObject',
headers: {
'Authorization': 'Basic ' + new Buffer('test:javascript-key=' + 'test').toString('base64')
}
}, (error, response, body) => {
expect(response.statusCode).toEqual(200);
done();
});
});
it('fails if database is unreachable', done => {
setServerConfiguration({