conninfo.test.ts
This file
Path
adapters/cloudflare-workers/src/conninfo.test.ts
19 lines 路 483 bytes 路 TypeScript
Last changed by
feat(adapters): add the seven adapters as workspace packages (#5463)Yusuke Wadabefore adoptionb877827
History of this fileTake it
1234567891011121314151617181920import { Context } from 'hono'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() })})