solid-start
solid-start copied to clipboard
[Bug?]: API requests missing HEAD request functionality
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Current behavior 😯
curl --head https://example.com/my/api/route.json
Always returns a 404
Expected behavior 🤔
Should return from a HEAD function if defined in the correct file, otherwise fall back on GET request (omitting the body of the response).
Steps to reproduce 🕹
Steps:
- Create an api file
src/routes/my/api/route.json.ts - Add
export function HEAD = async () => new Response('', { status: 200 }); - (OR) Add
export function GET = async () => new Response('', { status: 200 }); curl --head https://example.com/my/api/route.json
Context 🔦
I'm generating OG images on my server and using a third-party service to cache and re-serve them from their CDN. This services makes HEAD requests to ensure the file exists before attempting to serve it. Since HEAD responses are giving 404s, the service will not try to serve the file.
Your environment 🌎
n/a