pub trait RequestExt {
Show 17 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 with_stage_variables<V>(self, variables: V) -> Self
where V: Into<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) -> Self
fn with_raw_http_path<S>(self, path: S) -> Self
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) -> Self
fn with_query_string_parameters<Q>(self, parameters: Q) -> Self
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) -> Self
fn with_path_parameters<P>(self, parameters: P) -> Self
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 with_stage_variables<V>(self, variables: V) -> Self
fn with_stage_variables<V>(self, variables: V) -> Self
Configures instance with stage variables
This is intended for use in mock testing contexts.
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.