1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-29 08:09:18 +02:00

dispatcher internals testing (#1840)

This commit is contained in:
Rob Ede
2020-12-23 01:28:17 +00:00
committed by GitHub
parent 05f104c240
commit 2a7f2c1d59
8 changed files with 519 additions and 58 deletions

View File

@@ -58,6 +58,7 @@ impl Codec {
} else {
Flags::empty()
};
Codec {
config,
flags,
@@ -69,26 +70,26 @@ impl Codec {
}
}
/// Check if request is upgrade.
#[inline]
/// Check if request is upgrade
pub fn upgrade(&self) -> bool {
self.ctype == ConnectionType::Upgrade
}
/// Check if last response is keep-alive.
#[inline]
/// Check if last response is keep-alive
pub fn keepalive(&self) -> bool {
self.ctype == ConnectionType::KeepAlive
}
/// Check if keep-alive enabled on server level.
#[inline]
/// Check if keep-alive enabled on server level
pub fn keepalive_enabled(&self) -> bool {
self.flags.contains(Flags::KEEPALIVE_ENABLED)
}
/// Check last request's message type.
#[inline]
/// Check last request's message type
pub fn message_type(&self) -> MessageType {
if self.flags.contains(Flags::STREAM) {
MessageType::Stream