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

Support for case-sensitive headers #1454

Closed
2 tasks done
angel-langdon opened this issue Jan 30, 2022 · 1 comment
Closed
2 tasks done

Support for case-sensitive headers #1454

angel-langdon opened this issue Jan 30, 2022 · 1 comment

Comments

@angel-langdon
Copy link

Checklist

  • There are no similar issues or pull requests for this yet.
  • I discussed this idea on the community chat and feedback is positive.

Is your feature related to a problem? Please describe.

I am currently serving PDFs using StreamingReponse and Range Requests (https://tools.ietf.org/html/rfc7233) specific headers to load them in batches using Mozilla pdf.js javascript library. The problem is that they have a case-sensitive implementation of headers, this is causing to fail because Starlette by default lower cases all headers.

I have tried disabling .lower() in Response class manually and everything works as expected:
https://github.com/encode/starlette/blob/master/starlette/responses.py
image

Describe the solution you would like.

A parameter in Response that could be inherited through all responses that did enable case-sensitive headers

Describe alternatives you considered

I have considered copying Reponse and StreamingResponse classes and customize them to don't lower case headers, however I don't think this is a long term solution.

Additional context

There are many libraries that consider headers to be case sensitive

@Kludex
Copy link
Member

Kludex commented Jan 30, 2022

We are following the ASGI specifications.

There's already an open issue about this on the asgiref repository: django/asgiref#246

Once the specifications change there, we can comply here.

@Kludex Kludex closed this as completed Jan 30, 2022
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

No branches or pull requests

2 participants