4 ms·
A lot of people request a certain reply format by adding an extension like .json or .xml to the request. Seems easier that using Accept. With Accept you need t
by stesch 12y ago
A lot of people request a certain reply format by adding an extension like .json or .xml to the request. Seems easier that using Accept.
With Accept you need to parse the ";q=X" part as well.
See Accept when I access a website with Firefox: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Your REST API needs to understand this, according to these slides.
- gnaritas 12y agoThe accept header is designed to do this, the file names are a hack. Often times hacks are easier than standards, that doesn't mean they're correct.
- jchrisa 12y agoMimeparse has implementations in a lot of languages https://code.google.com/p/mimeparse/ https://code.google.com/p/mimeparse/