MCPcopy Index your code
hub / github.com/aws/aws-lambda-rust-runtime / RequestExt

Interface RequestExt

lambda-http/src/ext/extensions.rs:41–149  ·  view source on GitHub ↗

Extensions for [`lambda_http::Request`], `http::request::Parts`, and `http::Extensions` structs that provide access to [API gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format) and [ALB](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html) features. [`lamb

Source from the content-addressed store, hash-verified

39///
40/// [`lambda_http::Request`]: crate::Request
41pub trait RequestExt {
42 /// Return the raw http path for a request without any stage information.
43 fn raw_http_path(&self) -> &str;
44
45 /// Configures instance with the raw http path.
46 fn with_raw_http_path<S>(self, path: S) -> Self
47 where
48 S: Into<String>;
49
50 /// Return pre-parsed HTTP query string parameters, parameters
51 /// provided after the `?` portion of a URL,
52 /// associated with the API gateway request.
53 ///
54 /// The yielded value represents both single and multi-valued
55 /// parameters alike. When multiple query string parameters with the same
56 /// name are expected, use `query_string_parameters().all("many")` to
57 /// retrieve them all.
58 ///
59 /// Having no query parameters will yield an empty `QueryMap`.
60 fn query_string_parameters(&self) -> QueryMap;
61
62 /// Return pre-parsed HTTP query string parameters, parameters
63 /// provided after the `?` portion of a URL,
64 /// associated with the API gateway request.
65 ///
66 /// The yielded value represents both single and multi-valued
67 /// parameters alike. When multiple query string parameters with the same
68 /// name are expected, use
69 /// `query_string_parameters_ref().and_then(|params| params.all("many"))` to
70 /// retrieve them all.
71 ///
72 /// Having no query parameters will yield `None`.
73 fn query_string_parameters_ref(&self) -> Option<&QueryMap>;
74
75 /// Configures instance with query string parameters
76 ///
77 /// This is intended for use in mock testing contexts.
78 fn with_query_string_parameters<Q>(self, parameters: Q) -> Self
79 where
80 Q: Into<QueryMap>;
81
82 /// Return pre-extracted path parameters, parameter provided in URL placeholders
83 /// `/foo/{bar}/baz/{qux}`,
84 /// associated with the API gateway request. Having no path parameters
85 /// will yield an empty `QueryMap`.
86 ///
87 /// These will always be empty for ALB triggered requests.
88 fn path_parameters(&self) -> QueryMap;
89
90 /// Return pre-extracted path parameters, parameter provided in URL placeholders
91 /// `/foo/{bar}/baz/{qux}`,
92 /// associated with the API gateway request. Having no path parameters
93 /// will yield `None`.
94 ///
95 /// These will always be `None` for ALB triggered requests.
96 fn path_parameters_ref(&self) -> Option<&QueryMap>;
97
98 /// Configures instance with path parameters

Callers

nothing calls this directly

Implementers 1

extensions.rslambda-http/src/ext/extensions.rs

Calls

no outgoing calls

Tested by

no test coverage detected