Closed kolkov closed 8 years ago
For validation errors, the correct status code should be 400.
I suppose you are using ozzo-routing. You may use the fault.Recovery()
middleware and set your own error handler. In the error handler, you should check the type of the error. If you see validation.Errors
, you should set the status code as 400.
Thanks! Can you give me some example for ozzo-routing, please!
I'm creating a restful app boilerplate in Go and will publish it possibly next week.
Thanks! I want to create some more complex application example in ozzo with backend and frontend with Angular.
How to return correct http status error from validation error?
Return http 500, and error in json. Is it correct?