Skip to content
Merged
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: 12 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Rust

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
build:
Expand Down Expand Up @@ -68,6 +68,17 @@ jobs:
override: true
- name: Run fmt check
run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
override: true
- name: Run clippy check
run: cargo clippy

# publish rustdoc to a gh-pages branch on pushes to master
# this can be helpful to those depending on the mainline branch
Expand Down
1 change: 1 addition & 0 deletions lambda-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license = "Apache-2.0"
homepage = "https://github.com/awslabs/aws-lambda-rust-runtime"
repository = "https://github.com/awslabs/aws-lambda-rust-runtime"
documentation = "https://docs.rs/lambda_runtime"
categories = ["web-programming::http-server"]
readme = "../README.md"

[badges]
Expand Down
7 changes: 4 additions & 3 deletions lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ description = "AWS Lambda Runtime"
edition = "2018"
license = "Apache License 2.0"
repository = "https://github.com/awslabs/aws-lambda-rust-runtime"
categories = ["web-programming::http-server"]
keywords = ["AWS", "Lambda", "API"]
readme = "../README.md"

[features]
Expand All @@ -16,20 +18,19 @@ simulated = []
tokio = { version = "1.0", features = ["macros", "io-util", "sync", "rt-multi-thread"] }
hyper = { version = "0.14", features = ["http1", "client", "server", "stream", "runtime"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.39"
serde_json = "^1"
bytes = "1.0"
http = "0.2"
async-stream = "0.3"
futures = "0.3"
tracing-error = "0.1.2"
tracing = { version = "0.1", features = ["log"] }
tracing-futures = "0.2"
tower-service = "0.3"
tokio-stream = "0.1.2"

[dev-dependencies]
tracing-subscriber = "0.2"
once_cell = "1.4.0"
simple_logger = "1.6.0"
log = "0.4"
log = "^0.4"
simple-error = "0.2"
20 changes: 12 additions & 8 deletions lambda/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ where
.scheme(scheme.clone())
.authority(authority.clone())
.path_and_query(path.clone())
.build()
.expect("Unable to build URI");
.build();

parts.uri = uri;
Ok(Request::from_parts(parts, body))
match uri {
Ok(u) => {
parts.uri = u;
Ok(Request::from_parts(parts, body))
}
Err(e) => Err(Box::new(e)),
}
}

pub(crate) async fn call(&self, req: Request<Body>) -> Result<Response<Body>, Error> {
Expand Down Expand Up @@ -178,7 +182,7 @@ mod endpoint_tests {
tx.send(()).expect("Receiver has been dropped");
match server.await {
Ok(_) => Ok(()),
Err(e) if e.is_panic() => return Err::<(), Error>(e.into()),
Err(e) if e.is_panic() => Err::<(), Error>(e.into()),
Err(_) => unreachable!("This branch shouldn't be reachable"),
}
}
Expand Down Expand Up @@ -209,7 +213,7 @@ mod endpoint_tests {
tx.send(()).expect("Receiver has been dropped");
match server.await {
Ok(_) => Ok(()),
Err(e) if e.is_panic() => return Err::<(), Error>(e.into()),
Err(e) if e.is_panic() => Err::<(), Error>(e.into()),
Err(_) => unreachable!("This branch shouldn't be reachable"),
}
}
Expand Down Expand Up @@ -242,7 +246,7 @@ mod endpoint_tests {
tx.send(()).expect("Receiver has been dropped");
match server.await {
Ok(_) => Ok(()),
Err(e) if e.is_panic() => return Err::<(), Error>(e.into()),
Err(e) if e.is_panic() => Err::<(), Error>(e.into()),
Err(_) => unreachable!("This branch shouldn't be reachable"),
}
}
Expand Down Expand Up @@ -277,7 +281,7 @@ mod endpoint_tests {
tx.send(()).expect("Receiver has been dropped");
match server.await {
Ok(_) => Ok(()),
Err(e) if e.is_panic() => return Err::<(), Error>(e.into()),
Err(e) if e.is_panic() => Err::<(), Error>(e.into()),
Err(_) => unreachable!("This branch shouldn't be reachable"),
}
}
Expand Down
1 change: 1 addition & 0 deletions lambda/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ where

let handler = Arc::clone(&handler);
let request_id = &ctx.request_id.clone();
#[allow(clippy::async_yields_async)]
let task = tokio::spawn(async move { handler.call(body, ctx) });

let req = match task.await {
Expand Down