Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug?]: API requests missing HEAD request functionality #1657

Closed
2 tasks done
paularmstrong opened this issue Oct 22, 2024 · 0 comments · Fixed by #1661
Closed
2 tasks done

[Bug?]: API requests missing HEAD request functionality #1657

paularmstrong opened this issue Oct 22, 2024 · 0 comments · Fixed by #1661
Labels
bug Something isn't working

Comments

@paularmstrong
Copy link
Contributor

Duplicates

  • I have searched the existing issues

Latest version

  • 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:

  1. Create an api file src/routes/my/api/route.json.ts
  2. Add export function HEAD = async () => new Response('', { status: 200 });
  3. (OR) Add export function GET = async () => new Response('', { status: 200 });
  4. 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
@paularmstrong paularmstrong added the bug Something isn't working label Oct 22, 2024
paularmstrong added a commit to paularmstrong/solid-start that referenced this issue Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant