Skip to content

Commit

Permalink
Release 0.7.0 (#546)
Browse files Browse the repository at this point in the history
Ensure that we don't print internal warnings on user applications.

Signed-off-by: David Calavera <david.calavera@gmail.com>

Signed-off-by: David Calavera <david.calavera@gmail.com>
  • Loading branch information
calavera authored Oct 12, 2022
1 parent 1e16502 commit a0f6828
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lambda-extension/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda-extension"
version = "0.6.0"
version = "0.7.0"
edition = "2021"
authors = [
"David Calavera <dcalaver@amazon.com>",
Expand All @@ -19,7 +19,7 @@ bytes = "1.0"
chrono = { version = "0.4", features = ["serde"] }
http = "0.2"
hyper = { version = "0.14.20", features = ["http1", "client", "server", "stream", "runtime"] }
lambda_runtime_api_client = { version = "0.6", path = "../lambda-runtime-api-client" }
lambda_runtime_api_client = { version = "0.7", path = "../lambda-runtime-api-client" }
serde = { version = "1", features = ["derive"] }
serde_json = "^1"
tracing = { version = "0.1", features = ["log"] }
Expand Down
4 changes: 2 additions & 2 deletions lambda-http/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_http"
version = "0.6.2"
version = "0.7.0"
authors = [
"David Calavera <dcalaver@amazon.com>",
"Harold Sun <sunhua@amazon.com>"
Expand Down Expand Up @@ -28,7 +28,7 @@ bytes = "1"
http = "0.2"
http-body = "0.4"
hyper = "0.14.20"
lambda_runtime = { path = "../lambda-runtime", version = "0.6" }
lambda_runtime = { path = "../lambda-runtime", version = "0.7" }
serde = { version = "^1", features = ["derive"] }
serde_json = "^1"
serde_urlencoded = "0.7.0"
Expand Down
9 changes: 7 additions & 2 deletions lambda-http/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
//! Typically these are exposed via the `request_context`
//! request extension method provided by [lambda_http::RequestExt](../trait.RequestExt.html)
//!
use crate::ext::{PathParameters, QueryStringParameters, RawHttpPath, StageVariables};
#[cfg(any(feature = "apigw_rest", feature = "apigw_http", feature = "apigw_websockets"))]
use crate::ext::{PathParameters, StageVariables};
use crate::ext::{QueryStringParameters, RawHttpPath};
#[cfg(feature = "alb")]
use aws_lambda_events::alb::{AlbTargetGroupRequest, AlbTargetGroupRequestContext};
#[cfg(feature = "apigw_rest")]
Expand All @@ -19,7 +21,6 @@ use serde::Deserialize;
use serde_json::error::Error as JsonError;
use std::future::Future;
use std::pin::Pin;
use std::str::FromStr;
use std::{io::Read, mem};
use url::Url;

Expand Down Expand Up @@ -246,7 +247,10 @@ fn into_alb_request(alb: AlbTargetGroupRequest) -> http::Request<Body> {
req
}

#[cfg(feature = "alb")]
fn decode_query_map(query_map: QueryMap) -> QueryMap {
use std::str::FromStr;

let query_string = query_map.to_query_string();
let decoded = percent_encoding::percent_decode(query_string.as_bytes()).decode_utf8_lossy();
QueryMap::from_str(&decoded).unwrap_or_default()
Expand Down Expand Up @@ -304,6 +308,7 @@ fn into_websocket_request(ag: ApiGatewayWebsocketProxyRequest) -> http::Request<
req
}

#[cfg(any(feature = "apigw_rest", feature = "apigw_http", feature = "apigw_websockets"))]
fn apigw_path_with_stage(stage: &Option<String>, path: &str) -> String {
match stage {
None => path.into(),
Expand Down
13 changes: 6 additions & 7 deletions lambda-http/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ use aws_lambda_events::encodings::Body;
use encoding_rs::Encoding;
use http::header::CONTENT_ENCODING;
use http::HeaderMap;
use http::{
header::{CONTENT_TYPE, SET_COOKIE},
Response,
};
use http::{header::CONTENT_TYPE, Response};
use http_body::Body as HttpBody;
use hyper::body::to_bytes;
use mime::{Mime, CHARSET};
Expand All @@ -28,15 +25,15 @@ const X_LAMBDA_HTTP_CONTENT_ENCODING: &str = "x-lambda-http-content-encoding";
// See list of common MIME types:
// - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
// - https://github.com/ietf-wg-httpapi/mediatypes/blob/main/draft-ietf-httpapi-yaml-mediatypes.md
const TEXT_ENCODING_PREFIXES: [&'static str; 5] = [
const TEXT_ENCODING_PREFIXES: [&str; 5] = [
"text",
"application/json",
"application/javascript",
"application/xml",
"application/yaml",
];

const TEXT_ENCODING_SUFFIXES: [&'static str; 3] = ["+xml", "+yaml", "+json"];
const TEXT_ENCODING_SUFFIXES: [&str; 3] = ["+xml", "+yaml", "+json"];

/// Representation of Lambda response
#[doc(hidden)]
Expand All @@ -61,7 +58,7 @@ impl LambdaResponse {
b @ Body::Binary(_) => (true, Some(b)),
};

let mut headers = parts.headers;
let headers = parts.headers;
let status_code = parts.status.as_u16();

match request_origin {
Expand All @@ -75,6 +72,8 @@ impl LambdaResponse {
}),
#[cfg(feature = "apigw_http")]
RequestOrigin::ApiGatewayV2 => {
use http::header::SET_COOKIE;
let mut headers = headers;
// ApiGatewayV2 expects the set-cookies headers to be in the "cookies" attribute,
// so remove them from the headers.
let cookies = headers
Expand Down
6 changes: 3 additions & 3 deletions lambda-integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ readme = "../README.md"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
lambda_http = { path = "../lambda-http", version = "0.6" }
lambda_runtime = { path = "../lambda-runtime", version = "0.6" }
lambda-extension = { path = "../lambda-extension", version = "0.6" }
lambda_http = { path = "../lambda-http", version = "0.7" }
lambda_runtime = { path = "../lambda-runtime", version = "0.7" }
lambda-extension = { path = "../lambda-extension", version = "0.7" }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
tracing = { version = "0.1", features = ["log"] }
Expand Down
2 changes: 1 addition & 1 deletion lambda-runtime-api-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_runtime_api_client"
version = "0.6.0"
version = "0.7.0"
edition = "2021"
authors = [
"David Calavera <dcalaver@amazon.com>",
Expand Down
4 changes: 2 additions & 2 deletions lambda-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_runtime"
version = "0.6.1"
version = "0.7.0"
authors = [
"David Calavera <dcalaver@amazon.com>",
"Harold Sun <sunhua@amazon.com>"
Expand Down Expand Up @@ -30,4 +30,4 @@ async-stream = "0.3"
tracing = { version = "0.1", features = ["log"] }
tower = { version = "0.4", features = ["util"] }
tokio-stream = "0.1.2"
lambda_runtime_api_client = { version = "0.6", path = "../lambda-runtime-api-client" }
lambda_runtime_api_client = { version = "0.7", path = "../lambda-runtime-api-client" }

0 comments on commit a0f6828

Please sign in to comment.