Feature Request
I want to be able to set multiple headers with SetResponseHeaderLayer: needing one layer per header (plus me having issues returning impl Layer<S> relating to Send, Sync, etc), means that to set a bunch of default headers in a separate function than the one defining the service itself requires naming a type that is really long, made of a pile of tower::layer::util::Stack.
The use case for this is stuff like X-Content-Type-Options, X-Frame-Options, etc.
Motivation
There's a crate tower-default-headers which does this, but it's a third party crate and a pretty common use case.
Proposal
Some kind of SetResponseHeadersLayer that allows setting multiple headers, either using a Vec of them or a compile-time array or so.
Alternatives
Just use the third party crate;
Just write your own middleware which involves unfun async shenanigans.
Feature Request
I want to be able to set multiple headers with
SetResponseHeaderLayer: needing one layer per header (plus me having issues returningimpl Layer<S>relating toSend,Sync, etc), means that to set a bunch of default headers in a separate function than the one defining the service itself requires naming a type that is really long, made of a pile oftower::layer::util::Stack.The use case for this is stuff like X-Content-Type-Options, X-Frame-Options, etc.
Motivation
There's a crate
tower-default-headerswhich does this, but it's a third party crate and a pretty common use case.Proposal
Some kind of
SetResponseHeadersLayerthat allows setting multiple headers, either using a Vec of them or a compile-time array or so.Alternatives
Just use the third party crate;
Just write your own middleware which involves unfun async shenanigans.