3 ms·
Sorry, I don't follow what you mean. The accept header can specify mimetypes and negotiate what the response can look like. So maybe you could stretch it to say
by pseudoramble 5y ago
Sorry, I don't follow what you mean. The accept header can specify mimetypes and negotiate what the response can look like. So maybe you could stretch it to say "I'm only accepting SHA256" somehow. That might improve the API, but then you're indicating to the API to return 404's more often since it won't be able to find files with that hash.
Maybe there are other things you could do instead though? I'm not sure.
- 9dev 5y agoWell, I think you could definitely stretch it that way, because the Accept header is absolutely intended for situations like this: It lets you specify precisely which content formats you're willing to accept, and in which particular order. Accept: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, */*;q=0.8 No reason why that couldn't read like this instead: Accept: application/vnd.hash+sha256, application/vnd.hash+sha1;q=0.9, application/vnd.hash+md5;q=0.8 That would indicate to the server that you'd like to receive (preferably) SHA256, with a fallback to SHA1, and another fallback to MD5, if none of the other two is available. If the server isn't able to provide any of those, it returns a "406 Not Acceptable" response. HTTP covers all of this out of the box, people just tend to overlook the more advanced stuff.