Skip to content
Myr

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 file

Take it

feat(adapters): add the seven adapters as workspace packages (#5463)Yusuke Wadabefore adoptionb877827

lines 1–19why, one step back
1import { Context } from 'hono'
2import { getConnInfo } from './conninfo'34describe('getConnInfo', () => {5 it('Should getConnInfo works', () => {6 const address = Math.random().toString()7 const req = new Request('http://localhost/', {8 headers: {9 'cf-connecting-ip': address,10 },11 })12 const c = new Context(req)1314 const info = getConnInfo(c)1516 expect(info.remote.address).toBe(address)17 expect(info.remote.addressType).toBeUndefined()18 })19})