Skip to content
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: allow HEAD method for dynamic routes #58

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

n-dusan
Copy link
Contributor

@n-dusan n-dusan commented Nov 22, 2024

Description (e.g. "Related to ...", etc.)

stelae is now able to resolve requests with HEAD method.

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly

Automated tests, benchmarks and linters

You can run the tests, lints and benchmarks that are run on CI locally with:

just ci

stelae is now able to resolve HEAD method requests.
@n-dusan n-dusan self-assigned this Nov 22, 2024
Copy link
Contributor

@dgreisen dgreisen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: does the response to a HEAD request return the full content? or does it just return the header info? It should be the latter, so shouldn't even need to get the blob out of the git repo, just know if it is there.

@n-dusan
Copy link
Contributor Author

n-dusan commented Nov 22, 2024

question: does the response to a HEAD request return the full content? or does it just return the header info?

A HEAD request returns just the header info. For example:

C:\Users\nikol>curl --head http://localhost:8080/cityofsanmateo/law-html/HEAD/metadata.json
HTTP/1.1 200 OK
content-length: 1324
content-type: application/json
date: Fri, 22 Nov 2024 17:07:32 GMT

shouldn't even need to get the blob out of the git repo, just know if it is there.

It seems that the blob is being read. Potentially because of the content-length header. So it runs the function to determine its response size.

From my understanding, this is how HEAD semantics typically work. But if you believe this behavior can or should be adjusted, please let me know!

@n-dusan n-dusan requested a review from dgreisen November 22, 2024 17:23
@n-dusan n-dusan merged commit 4311cd8 into main Dec 13, 2024
4 checks passed
@n-dusan n-dusan deleted the ndusan/fix-serve-head-requests branch December 13, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants