Skip to content

Commit

Permalink
fix: revert to using Capital A in AUTHORIZATION_HEADER (#1183)
Browse files Browse the repository at this point in the history
* use capital A for AUTHORIZATION_HEADER

* fix: use .toLowerCase() to match Authorization header with nock output

* chore: lint

* chore: lint

* fix: typo
  • Loading branch information
EliasBjorne authored Jan 8, 2025
1 parent df9fa83 commit a05c5fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions packages/core/src/__tests__/cogniteClient.unit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,25 +241,25 @@ describe('CogniteClient', () => {
nock(mockBaseUrl)
.get('/test')
.reply(function () {
expect(this.req.headers[AUTHORIZATION_HEADER]).toStrictEqual([
'Bearer test-token0',
]);
expect(
this.req.headers[AUTHORIZATION_HEADER.toLowerCase()]
).toStrictEqual(['Bearer test-token0']);
return [401];
});
nock(mockBaseUrl)
.get('/test')
.reply(function () {
expect(this.req.headers[AUTHORIZATION_HEADER]).toStrictEqual([
'Bearer test-token1',
]);
expect(
this.req.headers[AUTHORIZATION_HEADER.toLowerCase()]
).toStrictEqual(['Bearer test-token1']);
return [401];
});
nock(mockBaseUrl)
.get('/test')
.reply(function () {
expect(this.req.headers[AUTHORIZATION_HEADER]).toStrictEqual([
'Bearer test-token2',
]);
expect(
this.req.headers[AUTHORIZATION_HEADER.toLowerCase()]
).toStrictEqual(['Bearer test-token2']);
return [200];
});

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const DEFAULT_DOMAIN = 'cognitedata.com';
export const BASE_URL = `https://${DEFAULT_CLUSTER}.${DEFAULT_DOMAIN}`;

/** @hidden */
export const AUTHORIZATION_HEADER = 'authorization';
export const AUTHORIZATION_HEADER = 'Authorization';
/** @hidden */
export const X_CDF_APP_HEADER = 'x-cdp-app';
/** @hidden */
Expand Down

0 comments on commit a05c5fc

Please sign in to comment.