You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
When buffalo is running as an API-only app in production and an error occurs, the application should respect the request's content type, the way it does in development.
A frontend application requesting JSON content is always expecting to get JSON, even if the content only contains error information.
Steps to Reproduce the Problem
Please describe in painful detail what you did (so others can play along with you) to get to this point. This includes things like the exact command(s) you used, or the curl command you used, that sort of thing.
Create an "API-only" application
Set GO_ENV to production
Make any request you know will produce an error, using application/json or any other non-html content-type header
Let your eyes rest on an HTML page, instead of showing you information about the error
Cry
Expected Behavior
One would expect the backend to always respect the request's content-type, and show useful error data when possible.
Description
When buffalo is running as an API-only app in production and an error occurs, the application should respect the request's content type, the way it does in development.
A frontend application requesting JSON content is always expecting to get JSON, even if the content only contains error information.
Steps to Reproduce the Problem
Please describe in painful detail what you did (so others can play along with you) to get to this point. This includes things like the exact command(s) you used, or the
curl
command you used, that sort of thing.production
application/json
or any other non-htmlcontent-type
headerExpected Behavior
One would expect the backend to always respect the request's content-type, and show useful error data when possible.
Actual Behavior
The response is HTML.
Fix
https://github.com/gobuffalo/buffalo/blob/master/errors.go#L168 should be removed so the content-type parsing and usage can be respected.
Additionally, errors should be cleaned to remove trace and other sensitive information.
The text was updated successfully, but these errors were encountered: