-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: make HEAD responses emtpy #600
Conversation
You can access the deployment of this PR at https://renku-ci-ds-600.dev.renku.ch |
tested with
etag and other headers are sent, content-length is 0 |
async def handle_head(request: Request, response: BaseHTTPResponse) -> None: | ||
"""Make sure HEAD requests return an empty body.""" | ||
if request.method == "HEAD": | ||
response.body = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean, the response has already been created and is now discarded before being rendered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. the response needs to be created in some cases as we return the etag in the headers (which gets calculated based on DB state) and a client getting the etag without having to receive the whole entity is one of the main use-cases for head requests in our case.
So it doesn't save on server processing, just unnecessary network traffic.
There's not really a better way to solve this with Sanic from what I could tell, other than implementing individual "HEAD" handlers for every endpoint we have.
Tearing down the temporary RenkuLab deplyoment for this PR. |
Pull Request Test Coverage Report for Build 12686153226Details
💛 - Coveralls |
This is not correct. The response headers SHOULD be the same as if the request verb was GET. See:
|
closes #582
/deploy