Closed mrcaidev closed 1 month ago
Hi @mrcaidev
Is it because Hono does not set up a real server when testing?
Yes. But, you can pass the server info as a 3rd argument on app.request()
:
const res = await app.request(
'/',
{},
{
server: {
requestIP: () => {
return {
address: '127.0.0.1',
family: 'foo',
port: '123'
}
}
}
}
)
It's like a workaround, but this is the best way.
What version of Hono are you using?
4.6.3
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
What is the expected behavior?
getConnInfo
should not fail in testing environment.What do you see instead?
Additional information
Is it because Hono does not set up a real server when testing?
If it is, is there any workaround? Otherwise, I have to manually skip
getConnInfo
withprocess.env.NODE_ENV === "test"
or similar codes every time.