fix: Accept lowercase Authorization tokens.

This commit is contained in:
Ruben Verborgh
2021-12-03 11:55:43 +01:00
parent 5a01f09f81
commit 9c52011add
6 changed files with 42 additions and 5 deletions

View File

@@ -62,6 +62,21 @@ describe('A BearerWebIdExtractor', (): void => {
});
});
describe('on a request with Authorization and a lowercase Bearer token', (): void => {
const request = {
method: 'GET',
headers: {
authorization: 'bearer token-1234',
},
} as any as HttpRequest;
it('calls the Bearer verifier with the correct parameters.', async(): Promise<void> => {
await webIdExtractor.handleSafe(request);
expect(solidTokenVerifier).toHaveBeenCalledTimes(1);
expect(solidTokenVerifier).toHaveBeenCalledWith('bearer token-1234');
});
});
describe('when verification throws an error', (): void => {
const request = {
method: 'GET',