Skip to content

Commit

Permalink
test: add fpjs-proxy-forwarded-host header test
Browse files Browse the repository at this point in the history
  • Loading branch information
Orkuncakilkaya committed Dec 14, 2023
1 parent 83252f5 commit 3c5c060
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions proxy/utils/headers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@ describe('prepareHeadersForIngressAPI', () => {

expect(result['fpjs-proxy-client-ip']).toBe(mockReq.headers['x-forwarded-for'])
expect(result['fpjs-proxy-secret']).toBe('secret')
expect(result['fpjs-proxy-forwarded-host']).toBe(new URL(mockReq.url).hostname)
})

it('should not set secret if it is undefined', () => {
const result = prepareHeadersForIngressAPI(mockReq, undefined)

expect(result['fpjs-proxy-client-ip']).toBe(mockReq.headers['x-forwarded-for'])
expect(result['fpjs-proxy-secret']).toBe(undefined)
expect(result['fpjs-proxy-forwarded-host']).toBe(undefined)
})
})

0 comments on commit 3c5c060

Please sign in to comment.