4 ms·
Browsers send "Accept: text/html" explicitly. For my pastebin[1], I send an HTML document when "text/html" is in the list of accepted formats, and I just send t
by mort96 4y ago
Browsers send "Accept: text/html" explicitly. For my pastebin[1], I send an HTML document when "text/html" is in the list of accepted formats, and I just send the plain data otherwise. This seems to work in practice, doesn't hard-code knowledge about curl, and doesn't require curl users to add custom headers.
[1]: https://sr.ht/~mort/coffeepaste/ https://sr.ht/~mort/coffeepaste/
- IanCal 4y agoI feel that neatly meets the kind of thing these params are for - if you ask a server for content and say "Accept: */*" the server should be free to return that content in whatever format it likes.
- dfbsdfbwe2ef2e 4y agoWhy do you feel that way?
- bawolff 4y agoThat's literally what the header means according to the rfc.
- masukomi 4y agoplus regardless of the official meaning, how _else_ would you interpret a header that's saying "I'll accept anything". Like the only reasonable response is "cool, here's what i felt like giving you since you gave me no guidance whatsoever and said you could handle anything"
- remram 4y agoThat format should probably be the original file then, the one that was uploaded/pasted.
- knoebber 4y agoYup, I do the same with dotfilehub.com E.G, curl https://dotfilehub.com/knoebber/emacs https://dotfilehub.com/knoebber/emacs results in plain text