Skip to content

Commit d9499d6

Browse files
committed
update deserializer usages
1 parent 8082f11 commit d9499d6

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

bottlecap/src/lifecycle/invocation/triggers/api_gateway_http_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::lifecycle::invocation::{
1616
pub struct APIGatewayHttpEvent {
1717
#[serde(rename = "routeKey")]
1818
pub route_key: String,
19-
#[serde(serialize_with = "lowercase_key")]
19+
#[serde(deserialize_with = "lowercase_key")]
2020
pub headers: HashMap<String, String>,
2121
#[serde(rename = "requestContext")]
2222
pub request_context: RequestContext,

bottlecap/src/lifecycle/invocation/triggers/api_gateway_rest_event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::lifecycle::invocation::{
1414

1515
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
1616
pub struct APIGatewayRestEvent {
17-
#[serde(serialize_with = "lowercase_key")]
17+
#[serde(deserialize_with = "lowercase_key")]
1818
pub headers: HashMap<String, String>,
1919
#[serde(rename = "requestContext")]
2020
pub request_context: RequestContext,
@@ -205,8 +205,8 @@ mod tests {
205205

206206
let expected = APIGatewayRestEvent {
207207
headers: HashMap::from([
208-
("Header1".to_string(), "value1".to_string()),
209-
("Header2".to_string(), "value2".to_string()),
208+
("header1".to_string(), "value1".to_string()),
209+
("header2".to_string(), "value2".to_string()),
210210
]),
211211
request_context: RequestContext {
212212
stage: "$default".to_string(),

bottlecap/src/lifecycle/invocation/triggers/lambda_function_url_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::lifecycle::invocation::{
1111

1212
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
1313
pub struct LambdaFunctionUrlEvent {
14-
#[serde(serialize_with = "lowercase_key")]
14+
#[serde(deserialize_with = "lowercase_key")]
1515
pub headers: HashMap<String, String>,
1616
#[serde(rename = "requestContext")]
1717
pub request_context: RequestContext,

bottlecap/tests/payloads/api_gateway_http_event.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
"rawPath": "/httpapi/get",
55
"rawQueryString": "",
66
"headers": {
7-
"accept": "*/*",
8-
"content-length": "0",
9-
"host": "x02yirxc7a.execute-api.sa-east-1.amazonaws.com",
10-
"user-agent": "curl/7.64.1",
11-
"x-amzn-trace-id": "Root=1-613a52fb-4c43cfc95e0241c1471bfa05",
12-
"x-forwarded-for": "38.122.226.210",
13-
"x-forwarded-port": "443",
14-
"x-forwarded-proto": "https",
15-
"x-datadog-trace-id": "12345",
16-
"x-datadog-parent-id": "67890",
17-
"x-datadog-sampling-priority": "2"
7+
"Accept": "*/*",
8+
"Content-Length": "0",
9+
"Host": "x02yirxc7a.execute-api.sa-east-1.amazonaws.com",
10+
"User-Agent": "curl/7.64.1",
11+
"X-amzn-trace-id": "Root=1-613a52fb-4c43cfc95e0241c1471bfa05",
12+
"X-forwarded-for": "38.122.226.210",
13+
"X-forwarded-port": "443",
14+
"X-forwarded-proto": "https",
15+
"X-datadog-trace-id": "12345",
16+
"X-datadog-parent-id": "67890",
17+
"X-datadog-sampling-priority": "2"
1818
},
1919
"requestContext": {
2020
"accountId": "425362996713",

0 commit comments

Comments
 (0)