conninfo.test.ts
This file
Path
src/adapter/vercel/conninfo.test.ts
18 lines 路 433 bytes 路 TypeScript
Last changed by
Not known.
History of this fileTake it
12345678910111213141516171819import { 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: { 'x-real-ip': address, }, }) const c = new Context(req)
const info = getConnInfo(c)
expect(info.remote.address).toBe(address) })})