Skip to content

Commit 6edca05

Browse files
author
Volodymyr Malyhin
committed
chore: fix build
1 parent 15e8ed3 commit 6edca05

File tree

1 file changed

+7
-40
lines changed

1 file changed

+7
-40
lines changed

registry/tests/util/axiosErrorTransformer.spec.ts

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import { AxiosError, AxiosHeaders } from 'axios';
22
import { expect } from 'chai';
3-
import {
4-
axiosErrorTransformer,
5-
isAxiosError,
6-
sanitizeHeaders,
7-
truncateBody,
8-
safeStringify,
9-
} from '../../server/util/axiosErrorTransformer';
3+
import { axiosErrorTransformer, isAxiosError } from '../../server/util/axiosErrorTransformer';
4+
import { sanitizeHeaders, truncateBody } from '../../server/util/helpers';
105

116
describe('axiosErrorTransformer', () => {
127
describe('isAxiosError', () => {
@@ -28,7 +23,7 @@ describe('axiosErrorTransformer', () => {
2823
});
2924

3025
describe('sanitizeHeaders', () => {
31-
it('should redact sensitive headers', () => {
26+
it('should exclude sensitive headers', () => {
3227
const headers = {
3328
'Content-Type': 'application/json',
3429
Authorization: 'Bearer token123',
@@ -41,10 +36,6 @@ describe('axiosErrorTransformer', () => {
4136

4237
expect(sanitized).to.deep.equal({
4338
'Content-Type': 'application/json',
44-
Authorization: '[REDACTED]',
45-
Cookie: '[REDACTED]',
46-
'X-API-Key': '[REDACTED]',
47-
'x-auth-token': '[REDACTED]',
4839
});
4940
});
5041

@@ -57,11 +48,7 @@ describe('axiosErrorTransformer', () => {
5748

5849
const sanitized = sanitizeHeaders(headers);
5950

60-
expect(sanitized).to.deep.equal({
61-
AUTHORIZATION: '[REDACTED]',
62-
'set-cookie': '[REDACTED]',
63-
'PROXY-AUTHORIZATION': '[REDACTED]',
64-
});
51+
expect(sanitized).to.deep.equal({});
6552
});
6653

6754
it('should return undefined for null/undefined headers', () => {
@@ -127,26 +114,6 @@ describe('axiosErrorTransformer', () => {
127114
});
128115
});
129116

130-
describe('safeStringify', () => {
131-
it('should stringify simple objects', () => {
132-
const result = safeStringify({ a: 1 });
133-
expect(result).to.equal('{"a":1}');
134-
});
135-
136-
it('should handle circular references', () => {
137-
const circular: Record<string, unknown> = { a: 1 };
138-
circular.self = circular;
139-
140-
const result = safeStringify(circular);
141-
expect(result).to.equal('[Circular or non-serializable]');
142-
});
143-
144-
it('should return undefined for null/undefined', () => {
145-
expect(safeStringify(null)).to.be.undefined;
146-
expect(safeStringify(undefined)).to.be.undefined;
147-
});
148-
});
149-
150117
describe('axiosErrorTransformer', () => {
151118
it('should pass through non-Axios errors unchanged', () => {
152119
const error = new Error('regular error');
@@ -190,9 +157,9 @@ describe('axiosErrorTransformer', () => {
190157
expect(result.data.method).to.equal('get');
191158
expect(result.data.timeout).to.equal(5000);
192159

193-
// Check header sanitization
194-
expect(result.data.headers.Authorization).to.equal('[REDACTED]');
195-
expect(result.data.response.headers['set-cookie']).to.equal('[REDACTED]');
160+
// Check header sanitization - sensitive headers should be excluded
161+
expect(result.data.headers.Authorization).to.be.undefined;
162+
expect(result.data.response.headers['set-cookie']).to.be.undefined;
196163
});
197164

198165
it('should transform network error (ECONNREFUSED)', () => {

0 commit comments

Comments
 (0)