Trailing Headers
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 76
- Avg merge
- 8h 59m
- Merged PRs (30d)
- 24
Description
Originally opened by
@tomchristieon 2020-08-08 10:49:55 in encode/httpx
One HTTP/1.1 feature that we don't currently support is trailing headers.
Hardly a high priority since it's seems so rarely used, but it might be worth our while someday.
It'd be interesting to hear from folks who do have use-cases here.
One option at the Transport API layer might be to update the AsyncByteStream/SyncByteStream APIs in order to handle this, without affecting the majority of code that doesn't expect or care about trailing headers, for example...
def get_trailing_headers() -> List[Tuple[byte, byte]]:
# This method depends on the state of `__iter__`/`__aiter__`.
# Once the byte stream has been fully consumed, any trailing headers may be accessed via this method.
return []
At the httpx level we could expose this information by mutating the response.headers once the stream has been iterated over.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the AsyncByteStream and SyncByteStream transport APIs, then trace how streamed responses expose headers. Explore the proposed trailing-header accessor and how response.headers could be updated after full stream consumption. Done means HTTP/1.1 trailing headers are supported without affecting streams that do not use them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100