conninfo.test.ts
This file
Path
src/adapter/cloudflare-workers/conninfo.test.ts
19 lines 路 492 bytes 路 TypeScript
Last changed by
Not known.
History of this fileTake it
1234567891011121314151617181920import { Context } from '../../context'import { getConnInfo } from './conninfo'
describe('getConnInfo', () => { it('Should getConnInfo works', () => { const address = Math.random().toString() const req = new Request('http://localhost/', { headers: { 'cf-connecting-ip': address, }, }) const c = new Context(req)
const info = getConnInfo(c)
expect(info.remote.address).toBe(address) expect(info.remote.addressType).toBeUndefined() })})