Skip to content

fix: Make SetMultiple*Header Clone for !Clone http bodies - #703

Merged
jlizen merged 1 commit into
tower-rs:mainfrom
Jesse-Bakker:fix/multiple-header-clone
Jun 3, 2026
Merged

jlizen merged 1 commit into
tower-rs:mainfrom
Jesse-Bakker:fix/multiple-header-clone

Conversation

@Jesse-Bakker

@Jesse-Bakker Jesse-Bakker commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Replace some derived Clone implementations with manual ones.

Motivation

For a couple structs, Clone was previously derived, creating a Clone bound
on the http request and therefore the request body. This meant that it wasn't
possible to use SetMultipleRequestHeader and SetMultipleResponseHeader for, for example, tonic.

Solution

Manually implement Clone for the relevant types, to avoid the
impl<M: Clone> Clone for T<M> bounds that caused the resulting service to not be Clone.

@Jesse-Bakker
Jesse-Bakker force-pushed the fix/multiple-header-clone branch from cf57499 to 12af67c Compare June 3, 2026 15:27

@jlizen jlizen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution!

assert!(debug_str.contains("SetMultipleRequestHeadersLayer"));
}

#[test]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding this test!

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.

2 participants