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

HTTPError with StatusBadRequest return a response with 500 Internal Error #41

Open
asaintgenis opened this issue Sep 18, 2017 · 1 comment

Comments

@asaintgenis
Copy link

Hello,

In the API layer of my app, Every call can return HTTPError with various Status.

For exemple in case of a no found objet for a GET call I return :
return routing.NewHTTPError(http.StatusNotFound, err.Error())
The response head will be correctly set.

But when I use the http.StatusBadRequest in the exact same way (for example a POST with invalid validation):

return routing.NewHTTPError(http.StatusBadRequest)

The response header is set to 500 Internal Server Error instead of 400 Bad request.

Thanks,
Regards,
Arthur

@aaronn
Copy link

aaronn commented Apr 4, 2019

I'm actually getting 500 Internal Server Error for every routing.NewHTTPError I return. Did you figure out what was causing this?

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

No branches or pull requests

2 participants