mirror of
https://github.com/directus/directus.git
synced 2026-02-11 22:14:56 -05:00
@@ -11,6 +11,7 @@ vi.mock('./env', async () => {
|
||||
LOG_LEVEL: 'info',
|
||||
LOG_STYLE: 'raw',
|
||||
};
|
||||
|
||||
return {
|
||||
default: MOCK_ENV,
|
||||
getEnv: () => MOCK_ENV,
|
||||
@@ -41,6 +42,7 @@ afterEach(() => {
|
||||
describe('req.headers.authorization', () => {
|
||||
test('Should redact bearer token in Authorization header', () => {
|
||||
const instance = pino(httpLoggerOptions, stream);
|
||||
|
||||
instance.info({
|
||||
req: {
|
||||
headers: {
|
||||
@@ -48,6 +50,7 @@ describe('req.headers.authorization', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(logOutput.mock.calls[0][0]).toMatchObject({
|
||||
req: {
|
||||
headers: {
|
||||
@@ -61,6 +64,7 @@ describe('req.headers.authorization', () => {
|
||||
describe('req.headers.cookie', () => {
|
||||
test('Should redact refresh token when there is only one entry', () => {
|
||||
const instance = pino(httpLoggerOptions, stream);
|
||||
|
||||
instance.info({
|
||||
req: {
|
||||
headers: {
|
||||
@@ -68,6 +72,7 @@ describe('req.headers.cookie', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(logOutput.mock.calls[0][0]).toMatchObject({
|
||||
req: {
|
||||
headers: {
|
||||
@@ -79,6 +84,7 @@ describe('req.headers.cookie', () => {
|
||||
|
||||
test('Should redact refresh token with multiple entries', () => {
|
||||
const instance = pino(httpLoggerOptions, stream);
|
||||
|
||||
instance.info({
|
||||
req: {
|
||||
headers: {
|
||||
@@ -86,6 +92,7 @@ describe('req.headers.cookie', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(logOutput.mock.calls[0][0]).toMatchObject({
|
||||
req: {
|
||||
headers: {
|
||||
@@ -99,6 +106,7 @@ describe('req.headers.cookie', () => {
|
||||
describe('res.headers', () => {
|
||||
test('Should redact refresh token when there is only one entry', () => {
|
||||
const instance = pino(httpLoggerOptions, stream);
|
||||
|
||||
instance.info({
|
||||
res: {
|
||||
headers: {
|
||||
@@ -106,6 +114,7 @@ describe('res.headers', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(logOutput.mock.calls[0][0]).toMatchObject({
|
||||
res: {
|
||||
headers: {
|
||||
@@ -117,6 +126,7 @@ describe('res.headers', () => {
|
||||
|
||||
test('Should redact refresh token with multiple entries', () => {
|
||||
const instance = pino(httpLoggerOptions, stream);
|
||||
|
||||
instance.info({
|
||||
res: {
|
||||
headers: {
|
||||
@@ -129,6 +139,7 @@ describe('res.headers', () => {
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(logOutput.mock.calls[0][0]).toMatchObject({
|
||||
res: {
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user