mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-20 02:31:35 +02:00
Add new_h1() back
This function turns out to be actually useful for testing and mocking
This commit is contained in:
parent
8a8302cf7b
commit
31d7b63ed7
2 changed files with 16 additions and 1 deletions
2
.bleep
2
.bleep
|
@ -1 +1 @@
|
|||
825cd20ff67b1fb257c704262bfcc35a15c6330d
|
||||
a73e00f51bc6643e93abedc2a763d38122ffb21d
|
|
@ -312,6 +312,21 @@ impl Session {
|
|||
}
|
||||
}
|
||||
|
||||
/// Create a new [Session] from the given [Stream]
|
||||
///
|
||||
/// This function is mostly used for testing and mocking.
|
||||
pub fn new_h1(stream: Stream) -> Self {
|
||||
let modules = HttpModules::new();
|
||||
Self::new(Box::new(HttpSession::new_http1(stream)), &modules)
|
||||
}
|
||||
|
||||
/// Create a new [Session] from the given [Stream] with modules
|
||||
///
|
||||
/// This function is mostly used for testing and mocking.
|
||||
pub fn new_h1_with_modules(stream: Stream, downstream_modules: &HttpModules) -> Self {
|
||||
Self::new(Box::new(HttpSession::new_http1(stream)), downstream_modules)
|
||||
}
|
||||
|
||||
pub fn as_downstream_mut(&mut self) -> &mut HttpSession {
|
||||
&mut self.downstream_session
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue