Default accept header?
#720
g105b
started this conversation in
General chat
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm thinking of changing the router's default content-type from
text/htmltoapplication/jsonin WebEngine. You can configure this value in theconfig.inifor the application, but I think it makes more sense to useapplication/jsonas the default. Here's my justification:When a user visits the application using their browser, the browser will always send the
accept: text/htmlheader - that's what browsers do. So we don't need to ever have a case that covers rendering a HTML page where the user has forgotten to send the correct accept header.However, when you're using
curlor other HTTP request tools, you're probably not going to want the HTML page. I would expect curl to make an API request rather than an HTML request, so a default ofapplication/jsonmakes sense for curl requests, but if I did want to download the HTML using curl, I could still setaccept: text/htmland get the HTML page routed, which is why I am voting that the default changes.Does this decision make any sense?
Beta Was this translation helpful? Give feedback.
All reactions