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

fix if statement bug in server #9

Merged
merged 1 commit into from Nov 29, 2022
Merged

fix if statement bug in server #9

merged 1 commit into from Nov 29, 2022

Conversation

tavvy
Copy link
Contributor

@tavvy tavvy commented Nov 28, 2022

This change fixes a bug with the handling of HEAD requests.

Previously we would never match on a HEAD request and thus incorrectly create a body to the request, which would throw an uncaught error

This change fixes a bug with the handling of `HEAD` requests.

Previously we would never match on a `HEAD` request and thus incorrectly create a body to the request, which would throw an uncaught error
@tavvy
Copy link
Contributor Author

tavvy commented Nov 28, 2022

spotted another small bug.
You can test with a curl -I <local-endpoint> and get a thrown error.

Perhaps it would be a good idea in a follow up PR to catch and handle errors thrown by the fetchCallback

        let res;
        try {
          res = (await fetchCallback(new Request(url.toString(), init)));
        } catch {
          res = new Response(null, { status: 50x })
        }

@yusukebe
Copy link
Member

Hi @tavvy !

This is a very elementary bug! Thank you for your fix. I'll merge it.

Perhaps it would be a good idea in a follow up PR to catch and handle errors thrown by the fetchCallback

Ah, you are right. It's a good idea.

@yusukebe yusukebe merged commit ac6f89f into honojs:main Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants