Add test infrastructure to work directly with frames (#56)
This adds a `Codec` based testing API. This is a bit less annoying than writing at the raw H2 wire protocol level...
This commit is contained in:
@@ -12,6 +12,13 @@ pub struct Ping {
|
||||
}
|
||||
|
||||
impl Ping {
|
||||
pub fn new() -> Ping {
|
||||
Ping {
|
||||
ack: false,
|
||||
payload: Payload::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pong(payload: Payload) -> Ping {
|
||||
Ping { ack: true, payload }
|
||||
}
|
||||
@@ -20,6 +27,11 @@ impl Ping {
|
||||
self.ack
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
pub fn payload(&self) -> &Payload {
|
||||
&self.payload
|
||||
}
|
||||
|
||||
pub fn into_payload(self) -> Payload {
|
||||
self.payload
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user