Skip to content

fix(static): support HEAD without opening files#2645

Open
paulkagiri wants to merge 1 commit into
falconry:masterfrom
paulkagiri:static-routes-head-support
Open

fix(static): support HEAD without opening files#2645
paulkagiri wants to merge 1 commit into
falconry:masterfrom
paulkagiri:static-routes-head-support

Conversation

@paulkagiri
Copy link
Copy Markdown

Summary of Changes

Static routes now handle HEAD separately from GET: they compute the same response metadata without opening a file stream, preserve range headers for ranged HEAD requests, and return 405 Method Not Allowed for unsupported methods. OPTIONS now advertises both GET and HEAD.

Related Issues

Closes #2337

Pull Request Checklist

  • Applied changes to both WSGI and ASGI code paths and interfaces (where applicable).
  • Added tests for changed code.
  • Performed automated tests and code quality checks by running tox.
  • Prefixed code comments with GitHub nick and an appropriate prefix.
  • Coding style is consistent with the rest of the framework.
  • Updated documentation for changed code.
  • Changes have towncrier news fragments under docs/_newsfragments/, with the file name format {issue_number}.{fragment_type}.rst.
  • LLM output, if any, has been carefully reviewed and tested by a human developer.

Testing performed:

  • python -m pytest tests/test_static.py -q
  • git diff --check

Copy link
Copy Markdown
Member

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

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

Hey, and thanks for this PR.
Please check the failing CI, most of the gates fail on your changes.

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.

Proper HEAD support for static routes

2 participants