Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ impl LambdaHttpEvent<'_> {
match self {
Self::ApiGatewayHttpV2(event) => {
let path = encode_path_query(&event.raw_path);
let query = &event.raw_query_string as &str;
if query.is_empty() {
// No query string
path.into_owned()
} else {

match event.raw_query_string.as_ref().filter(|x| !x.is_empty()) {
// With query string
format!("{}?{}", path, query)
Some(query) => format!("{}?{}", path, query),
// No query string
_ => path.into_owned(),
}
}
Self::ApiGatewayRestOrAlb(event) => {
Expand Down Expand Up @@ -242,7 +241,7 @@ pub(crate) struct ApiGatewayHttpV2Event<'a> {
#[allow(dead_code)]
version: String,
raw_path: String,
raw_query_string: String,
raw_query_string: Option<String>,
cookies: Option<Vec<String>>,
headers: HashMap<String, String>,
//#[serde(borrow)]
Expand Down
5 changes: 3 additions & 2 deletions src/rocket05.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ use std::sync::Arc;
pub async fn launch_rocket_on_lambda<P: rocket::Phase>(
r: rocket::Rocket<P>,
) -> Result<(), LambdaError> {
lambda_runtime::run(RocketHandler(Arc::new(
let handler: RocketHandler = RocketHandler(Arc::new(
rocket::local::asynchronous::Client::untracked(r).await?,
)))
));
lambda_runtime::run(handler)
.await?;

Ok(())
Expand Down