up icon indicating copy to clipboard operation
up copied to clipboard

Explicit responses should bypass error pages

Open tj opened this issue 7 years ago • 3 comments

Currently if text/html is accepted, Up will serve the error page. It seems common for people to fetch() or curl without explicitly setting Accept: application/json or similar, resulting in the HTML which can be confusing.

We could disable error pages by default, or maybe drop content negotiation and assume non-text/plain responses are intentional, something like that.

Note to self: at least document Accept usage

tj avatar Aug 10 '18 23:08 tj

I would definitely prefer the above mentioned

benjaminbalazs avatar Aug 20 '18 13:08 benjaminbalazs

I think this is a good idea - I got caught out by this and it took a good while to realize what was going on due to obscure messages Apollo Client was spitting out. Id recommend error pages to be Opt-in. If not - a big warning on the docs that an "unexpected token" error is likely due to this.

ghost avatar Aug 27 '18 22:08 ghost

@glenarama interesting that Apollo doesn't set Accept, but yea I'm definitely starting to think assuming people utilize the header is a bad idea haha, easier to make it opt-in

tj avatar Aug 28 '18 00:08 tj