pub struct GatewayRequest {
pub method: String,
pub path: String,
pub host: String,
pub scheme: String,
pub headers: HashMap<String, Vec<String>>,
pub query_params: HashMap<String, Vec<String>>,
pub body: Bytes,
pub remote_addr: String,
pub protocol: Protocol,
}Expand description
Protocol-agnostic snapshot of the inbound request, decoupled from hyper types.
Multi-valued headers and query parameters are preserved as Vec<String>.
The body is fully buffered; it serializes as base64 (see bytes_serde),
which is how it crosses into Lua scripts.
Fields§
§method: StringHTTP method (GET, POST, …).
path: StringRequest path without the query string.
host: StringValue of the Host header (empty string when absent).
scheme: StringURI scheme, defaulting to http when the URI carries none.
headers: HashMap<String, Vec<String>>Header name → list of values (headers may repeat).
query_params: HashMap<String, Vec<String>>Query parameter name → list of values (parameters may repeat).
body: BytesFully buffered request body, serialized as base64.
remote_addr: StringClient socket address as ip:port.
protocol: ProtocolWire protocol the request arrived on.
Implementations§
Source§impl GatewayRequest
impl GatewayRequest
Sourcepub fn from_hyper(req: &Parts, body: Bytes, remote_addr: SocketAddr) -> Self
pub fn from_hyper(req: &Parts, body: Bytes, remote_addr: SocketAddr) -> Self
Builds a GatewayRequest from parsed hyper request parts and a buffered body.
Non-UTF-8 header values become empty strings, the query string is split
on &/= without percent-decoding, and the protocol is classified as
HTTP/2 only for http::Version::HTTP_2 (HTTP/1.x otherwise).
Trait Implementations§
Source§impl Clone for GatewayRequest
impl Clone for GatewayRequest
Source§fn clone(&self) -> GatewayRequest
fn clone(&self) -> GatewayRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GatewayRequest
impl Debug for GatewayRequest
Source§impl<'de> Deserialize<'de> for GatewayRequest
impl<'de> Deserialize<'de> for GatewayRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !Freeze for GatewayRequest
impl RefUnwindSafe for GatewayRequest
impl Send for GatewayRequest
impl Sync for GatewayRequest
impl Unpin for GatewayRequest
impl UnsafeUnpin for GatewayRequest
impl UnwindSafe for GatewayRequest
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more