storage
storage copied to clipboard
add HEAD Mehthod to getObjects route
What kind of change does this PR introduce?
Add a HEAD Method to getObject route so clients can get headers without requesting whole object.
What is the current behavior?
I get a 400 which is ok but a 405 would be better 😂
What is the new behavior?
A HEAD request just like the GET but without the body (see https://github.com/fastify/fastify/pull/2700/)
Hi @buschco, I am worried that people might do a HEAD request and assume that an object exists at that route when it doesn't. For example /bucket/memes/cat-doesnt-exist.jpg will return a 200 which is confusing. If we are adding a HEAD request for getObject, I would rather only return a 200 if the object exists and the user has permissions to download it.
@inian is this in the behavior of HEAD request in Fastify (or in general) returning 200 even if the GET would result in 4xx?
I could not find evidence for such behavior in the Fastify PR, am I missing something?
Ah I just checked and it does look like Fastify returns the same status code as the GET endpoint rather than returning 200 always which is good.
Can you help check if the docs exported also have the HEAD method documented @buschco?
Unfortunately the HEAD route is not in the generated static/api.json 😕
We could raise an inssue in fastify/swagger or keep it a hidden feature.
Okay, I will merge the PR in. Can you open an issue in fastify/swagger and an issue in our repo so that we remember to add support this in our docs (or ensure this is fixed) after fastify adds support for it? Till then it can be a hidden feature ;)
I raised the issue -> https://github.com/fastify/fastify-swagger/issues/648
thank you 🙂
hmm the tests are failing for some reason. will merge once I debug why thats happening
:tada: This PR is included in version 0.21.4 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: