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

Better error handling when using a 'post' utility on a non-post method #858

Open
1 task done
AdamBD opened this issue Aug 8, 2024 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@AdamBD
Copy link

AdamBD commented Aug 8, 2024

Describe the feature

If you have the following handlers

export default defineEventHandler(async (event) => {
	const body = await readBody(event)
        const headers = getRequestHeaders(event)
       return headers
})

and make a GET call to this route, you will get the following error:

image

This method is obtuse and doesnt help you understand what the issue is.

Its a silly mistake but was non-obvious that this is a problem

Additional information

  • Would you be willing to help implement this feature?
@AdamBD AdamBD added the enhancement New feature or request label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant