-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get Content-Length info with HEAD request #2239
Comments
I'm not aware of there being any recent functional changes to the API that would have caused this behaviour change. Are you sure you were making HEAD requests for what would have otherwise been POST requests? That is not consistent with my understanding of how HTTP requests work, based on https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD |
Are you referring to the ability to:
(From the mdn link) |
Hello there, thank you for answer. Actually yes, reffering as from the mdn link: For example, if a URL might produce a large download, a HEAD request could read its Content-Length header to check the filesize without actually downloading the file. It also says There is no ETag so how can I be able to get Content-Length with request body and without response body is what I'm wondering actually. I am working with big queries, so I was trying to build a caching system to check for recent changes in identifying vulnerabilities in multiple versions of numerous dependencies. After sending POST requests to query batches and getting vulnerability reports, I wanted to check if there were any changes in those versions without sending another POST request. Instead, I planned to send a HEAD request to get the Content-Length. If the Content-Length of the previous POST request is equal to the Content-Length of the HEAD request, it would indicate that the response bodies of the two requests are the same. I am not sure if I am missing something else.
Yes, this is exactly the functionality I am looking for. Is it feasible, or am I missing something? |
Disclaimer: I have only done very superficial research into this to refresh my dated understanding of the HTTP protocol. My understanding is that HTTP POST requests are generally not cachable. To make them cachable would be new API functionality and would require maintaining a server-side cache of the results of the exact set of inputs, which seems like it would have a very low probability of broad cache hits (obviously, for someone like yourself repeatedly requerying with the same inputs, it might). Could you please file a new API feature request issue with the following information to allow us to prioritise:
If I've missed something, feel free to reopen and add more context, otherwise please file a fresh issue per above. |
Describe the bug
Hello there, I am using OSV-API query/querybatch endpoints on my project to get vulnerability list.
I was able to get Content-Length through HEAD request like a week ago.
Now, I'm getting 400 Bad Request when I try to send a HEAD request to get Content-Length.
I was building a system to compare between POST request and HEAD request of given endpoints. content-lengths.
I don't know if it's a bug but I think I was able to get HEAD request response header a week ago.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
Getting Content-Length = 3863 info on Header response just like POST request without response body.
Screenshots
POST
HEAD
Additional context
If HEAD request was not a feature and service has been removed, is there any chance to bring it back again?
Thank you.
The text was updated successfully, but these errors were encountered: