Open rchaud opened 1 month ago
Seems I was using the wrong curl argument
Actually, it seems that curl -I or curl --head is not seeing by Elysia. Im trying to use Uptime Robot and the check is using HEAD.
I am having the same problem. And the downstream effect of this is that provisioning an android device fails because the HEAD call returns 404.
I think this works as intended.
For HEAD
requests, you need to explicitly add a .head()
handler, or use .all()
:
import Elysia from 'elysia'
const app = new Elysia()
.get('/get', () => 'Hello from /get')
.head('/head', () => 'Hello from /head')
.all('/all', () => 'Hello from /all')
for (const url of ['https://example.com/get', 'https://example.com/head', 'https://example.com/all']) {
for (const method of ['GET', 'HEAD']) {
const res = await app.handle(new Request(url, {method}))
console.log(method.padEnd(4), url, '→', res.status, await res.text())
}
}
Output:
What version of Elysia is running?
1.1.29
What platform is your computer?
Docker
What steps can reproduce the bug?
What is the expected behavior?
We are expecting a 200 return code from the URL.
What do you see instead?
Additional information
It seems any routes I create will result in a 404.
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes