Skip to content

Commit

Permalink
Add new_h1() back
Browse files Browse the repository at this point in the history
This function turns out to be actually useful for testing and mocking
  • Loading branch information
eaufavor authored and johnhurt committed Jun 7, 2024
1 parent 8a8302c commit 31d7b63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
825cd20ff67b1fb257c704262bfcc35a15c6330d
a73e00f51bc6643e93abedc2a763d38122ffb21d
15 changes: 15 additions & 0 deletions pingora-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 31d7b63

Please sign in to comment.