openlawlibrary / stelae

Preservation, Authentication, Access
GNU Affero General Public License v3.0
7 stars 1 forks source link

fix: allow `HEAD` method for dynamic routes #58

Open n-dusan opened 1 week ago

n-dusan commented 1 week ago

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

stelae is now able to resolve requests with HEAD method.

Code review checklist (for code reviewer to complete)

Automated tests, benchmarks and linters

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

just ci
n-dusan commented 1 week ago

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!