gobuffalo / buffalo

Rapid Web Development w/ Go
http://gobuffalo.io
MIT License
8.07k stars 573 forks source link

Auto render does not obey http headers correctly #948

Open deanroker123 opened 6 years ago

deanroker123 commented 6 years ago

It appears as though the auto render function looks at the content type header over the accept header to determine what to return to the client.

As far as I know content type gives an indication to the receiver what is in the request and accept tells the receiver what the client expects to receive back.

So a client posting json to the server would have that as the content type and an accept header set to html so it gets an html document back.

Or could set the both the same to post json and get json back.

forrest321 commented 6 years ago

Relevant code starts here:

https://github.com/gobuffalo/buffalo/blob/932f95b2b4b7821a1b8369bd64845225ab1117b3/render/auto.go#L63