Trait lambda_http::ext::extensions::RequestExt
source · pub trait RequestExt {
Show 16 methods
// Required methods
fn raw_http_path(&self) -> &str;
fn with_raw_http_path<S>(self, path: S) -> Self
where S: Into<String>;
fn query_string_parameters(&self) -> QueryMap;
fn query_string_parameters_ref(&self) -> Option<&QueryMap>;
fn with_query_string_parameters<Q>(self, parameters: Q) -> Self
where Q: Into<QueryMap>;
fn path_parameters(&self) -> QueryMap;
fn path_parameters_ref(&self) -> Option<&QueryMap>;
fn with_path_parameters<P>(self, parameters: P) -> Self
where P: Into<QueryMap>;
fn stage_variables(&self) -> QueryMap;
fn stage_variables_ref(&self) -> Option<&QueryMap>;
fn request_context(&self) -> RequestContext;
fn request_context_ref(&self) -> Option<&RequestContext>;
fn with_request_context(self, context: RequestContext) -> Self;
fn lambda_context(&self) -> Context;
fn lambda_context_ref(&self) -> Option<&Context>;
fn with_lambda_context(self, context: Context) -> Self;
}
Expand description
Extensions for lambda_http::Request
, http::request::Parts
, and http::Extensions
structs
that provide access to
API gateway
and ALB
features.
Required Methods§
sourcefn raw_http_path(&self) -> &str
fn raw_http_path(&self) -> &str
Return the raw http path for a request without any stage information.
sourcefn with_raw_http_path<S>(self, path: S) -> Selfwhere
S: Into<String>,
fn with_raw_http_path<S>(self, path: S) -> Selfwhere S: Into<String>,
Configures instance with the raw http path.
sourcefn query_string_parameters(&self) -> QueryMap
fn query_string_parameters(&self) -> QueryMap
Return pre-parsed HTTP query string parameters, parameters
provided after the ?
portion of a URL,
associated with the API gateway request.
The yielded value represents both single and multi-valued
parameters alike. When multiple query string parameters with the same
name are expected, use query_string_parameters().all("many")
to
retrieve them all.
Having no query parameters will yield an empty QueryMap
.
sourcefn query_string_parameters_ref(&self) -> Option<&QueryMap>
fn query_string_parameters_ref(&self) -> Option<&QueryMap>
Return pre-parsed HTTP query string parameters, parameters
provided after the ?
portion of a URL,
associated with the API gateway request.
The yielded value represents both single and multi-valued
parameters alike. When multiple query string parameters with the same
name are expected, use
query_string_parameters_ref().and_then(|params| params.all("many"))
to
retrieve them all.
Having no query parameters will yield None
.
sourcefn with_query_string_parameters<Q>(self, parameters: Q) -> Selfwhere
Q: Into<QueryMap>,
fn with_query_string_parameters<Q>(self, parameters: Q) -> Selfwhere Q: Into<QueryMap>,
Configures instance with query string parameters
This is intended for use in mock testing contexts.
sourcefn path_parameters(&self) -> QueryMap
fn path_parameters(&self) -> QueryMap
Return pre-extracted path parameters, parameter provided in URL placeholders
/foo/{bar}/baz/{qux}
,
associated with the API gateway request. Having no path parameters
will yield an empty QueryMap
.
These will always be empty for ALB triggered requests.
sourcefn path_parameters_ref(&self) -> Option<&QueryMap>
fn path_parameters_ref(&self) -> Option<&QueryMap>
Return pre-extracted path parameters, parameter provided in URL placeholders
/foo/{bar}/baz/{qux}
,
associated with the API gateway request. Having no path parameters
will yield None
.
These will always be None
for ALB triggered requests.
sourcefn with_path_parameters<P>(self, parameters: P) -> Selfwhere
P: Into<QueryMap>,
fn with_path_parameters<P>(self, parameters: P) -> Selfwhere P: Into<QueryMap>,
Configures instance with path parameters
This is intended for use in mock testing contexts.
sourcefn stage_variables(&self) -> QueryMap
fn stage_variables(&self) -> QueryMap
Return stage variables
associated with the API gateway request. Having no stage parameters
will yield an empty QueryMap
.
These will always be empty for ALB triggered requests.
sourcefn stage_variables_ref(&self) -> Option<&QueryMap>
fn stage_variables_ref(&self) -> Option<&QueryMap>
Return stage variables
associated with the API gateway request. Having no stage parameters
will yield None
.
These will always be None
for ALB triggered requests.
sourcefn request_context(&self) -> RequestContext
fn request_context(&self) -> RequestContext
Return request context data associated with the ALB or API gateway request
sourcefn request_context_ref(&self) -> Option<&RequestContext>
fn request_context_ref(&self) -> Option<&RequestContext>
Return a reference to the request context data associated with the ALB or API gateway request
sourcefn with_request_context(self, context: RequestContext) -> Self
fn with_request_context(self, context: RequestContext) -> Self
Configures instance with request context
This is intended for use in mock testing contexts.
sourcefn lambda_context(&self) -> Context
fn lambda_context(&self) -> Context
Return Lambda function context data associated with the request
sourcefn lambda_context_ref(&self) -> Option<&Context>
fn lambda_context_ref(&self) -> Option<&Context>
Return a reference to the Lambda function context data associated with the request
sourcefn with_lambda_context(self, context: Context) -> Self
fn with_lambda_context(self, context: Context) -> Self
Configures instance with lambda context