mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-07-02 04:12:36 +00:00
* fix: refresh CloudFront media cookies * fix: satisfy changed-file lint * fix: centralize CloudFront image retry * fix: honor base path for CloudFront refresh * fix: bypass auth refresh for CloudFront cookie retry * fix: pass app auth header to CloudFront retry * test: cover CloudFront refresh with OpenID reuse * fix: avoid duplicate CloudFront refresh retries * fix: clear CloudFront scope cookie with matching flags
26 lines
957 B
TypeScript
26 lines
957 B
TypeScript
import axios from 'axios';
|
|
import { getTokenHeader, setTokenHeader } from '../src/headers-helpers';
|
|
|
|
describe('setTokenHeader', () => {
|
|
afterEach(() => {
|
|
delete axios.defaults.headers.common['Authorization'];
|
|
});
|
|
|
|
it('sets the Authorization header with a Bearer token', () => {
|
|
setTokenHeader('my-token');
|
|
expect(axios.defaults.headers.common['Authorization']).toBe('Bearer my-token');
|
|
expect(getTokenHeader()).toBe('Bearer my-token');
|
|
});
|
|
|
|
it('deletes the Authorization header when called with undefined', () => {
|
|
axios.defaults.headers.common['Authorization'] = 'Bearer old-token';
|
|
setTokenHeader(undefined);
|
|
expect(axios.defaults.headers.common['Authorization']).toBeUndefined();
|
|
expect(getTokenHeader()).toBeUndefined();
|
|
});
|
|
|
|
it('is a no-op when clearing an already absent header', () => {
|
|
setTokenHeader(undefined);
|
|
expect(axios.defaults.headers.common['Authorization']).toBeUndefined();
|
|
});
|
|
});
|