You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked for existing issues (including closed) about this
Feature Request
Please implement Clone for AppendHeaders.
Motivation
I need it in my project. I once and forever create an AppendHeaders object which contains some headers that I add to every response. However, when I create a response, the AppendHeaders object is consumed by into_response_parts(...) of IntoResponseParts. So I need to be able to clone it for every response.
Proposal
Add a #[derive(Clone)] to the AppendHeaders struct.
I guess could only store the contents of my AppendHeaders object, which I can clone, and then construct a new AppendHeaders object from cloned contents for every reponse. However, I really want to store the wrapping AppendHeaders object, because that it the correct semantics.
I think it's very natural that AppendHeaders should be clonable (if the contents are clonable), and I'm surprised that it's not already implemented.
The text was updated successfully, but these errors were encountered:
jbirnick
changed the title
implement Clone for AppendHeaders
Implement Clone for AppendHeadersJun 7, 2024
Seems reasonable, and we already derive this for many extractors, as well as the Html response wrappers.
Do you want to send a PR? Deriving Copy would be good as well for consistency.
Feature Request
Please implement
Clone
forAppendHeaders
.Motivation
I need it in my project. I once and forever create an
AppendHeaders
object which contains some headers that I add to every response. However, when I create a response, theAppendHeaders
object is consumed byinto_response_parts(...)
ofIntoResponseParts
. So I need to be able to clone it for every response.Proposal
Add a
#[derive(Clone)]
to theAppendHeaders
struct.Alternatives
I guess could only store the contents of my
AppendHeaders
object, which I can clone, and then construct a newAppendHeaders
object from cloned contents for every reponse. However, I really want to store the wrappingAppendHeaders
object, because that it the correct semantics.I think it's very natural that
AppendHeaders
should be clonable (if the contents are clonable), and I'm surprised that it's not already implemented.The text was updated successfully, but these errors were encountered: