Skip to content

Commit 51eaf99

Browse files
committed
add test
1 parent c47e54b commit 51eaf99

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/core/test/lib/utils/request.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,25 @@ describe('request utils', () => {
219219
});
220220
});
221221

222+
it('should prioritize x-forwarded-proto header even when downgrading from https to http', () => {
223+
const actual = httpRequestToRequestData({
224+
url: '/test',
225+
headers: {
226+
host: 'example.com',
227+
'x-forwarded-proto': 'http',
228+
},
229+
protocol: 'https',
230+
});
231+
232+
expect(actual).toEqual({
233+
url: 'http://example.com/test',
234+
headers: {
235+
host: 'example.com',
236+
'x-forwarded-proto': 'http',
237+
},
238+
});
239+
});
240+
222241
it('should prioritize x-forwarded-proto header over socket encryption detection', () => {
223242
const actual = httpRequestToRequestData({
224243
url: '/test',

0 commit comments

Comments
 (0)