feat: set multiple request header#677
Merged
jlizen merged 4 commits intoMay 14, 2026
Merged
Conversation
… layer multiple header middleware Signed-off-by: Aminu Oluwaseun Joshua <seun.aminujoshua@gmail.com>
jlizen
requested changes
May 12, 2026
Signed-off-by: Aminu Oluwaseun Joshua <seun.aminujoshua@gmail.com>
jlizen
requested changes
May 12, 2026
Signed-off-by: Aminu Oluwaseun Joshua <seun.aminujoshua@gmail.com>
jlizen
requested changes
May 14, 2026
jlizen
left a comment
Member
There was a problem hiding this comment.
Looks good, one last Clone impl needed, sorry to scope creep you.
Signed-off-by: Aminu Oluwaseun Joshua <seun.aminujoshua@gmail.com>
jlizen
approved these changes
May 14, 2026
jlizen
added a commit
to jlizen/tower-http
that referenced
this pull request
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #676
Adds native support for inserting multiple header middleware per layer
Solution
For better code organisation, the request.rs file, which handles the request, is now a module and split into two files. One for setting a single header and the other for multiple, while still maintaining the current API structure.
The functions handling setting headers take a dynamic variable that implements HeaderMetadataGenerator. The newly created HeaderMetadata and a tuple of (HeaderName, M), currently implemented in
M, can be HeaderValue (A test case covers this). This also helps with maintainability.It also includes tests
The PR also moved some reused code into the root module for easy access by both request and response headers