mirror of
https://github.com/TrueLayer/reqwest-middleware.git
synced 2024-12-25 18:36:30 +00:00
[BOT-272] ClientBuilder extend convenience function
This commit is contained in:
parent
c558e7414a
commit
d406eb2ce7
1 changed files with 8 additions and 0 deletions
|
@ -31,6 +31,14 @@ impl ClientBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
/// Convenience method to extend a ClientBuilder instance by appending
|
||||
/// the middleware and initialiser stacks from a ClientwithMiddleware
|
||||
pub fn extend(mut self, client_with_middleware: ClientWithMiddleware) -> Self {
|
||||
self.middleware_stack.append(&mut client_with_middleware.middleware_stack.into_vec());
|
||||
self.initialiser_stack.append(&mut client_with_middleware.initialiser_stack.into_vec());
|
||||
self
|
||||
}
|
||||
|
||||
/// Convenience method to attach middleware.
|
||||
///
|
||||
/// If you need to keep a reference to the middleware after attaching, use [`with_arc`].
|
||||
|
|
Loading…
Reference in a new issue