Skip to content

Commit 52bbe3e

Browse files
committed
Update AwsSpringHttpProcessingUtilsTests.java
Added unit test for when there are no multivalue headers
1 parent f5b0710 commit 52bbe3e

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

aws-serverless-java-container-springboot3/src/test/java/com/amazonaws/serverless/proxy/spring/AwsSpringHttpProcessingUtilsTests.java

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,57 @@ public class AwsSpringHttpProcessingUtilsTests {
115115
+ " \"isBase64Encoded\": false\n"
116116
+ "}";
117117

118+
private static String API_GATEWAY_EVENT_WITHOUT_MULTIVALUE_HEADERS = "{\n"
119+
+ " \"version\": \"1.0\",\n"
120+
+ " \"resource\": \"$default\",\n"
121+
+ " \"path\": \"/async\",\n"
122+
+ " \"httpMethod\": \"POST\",\n"
123+
+ " \"headers\": {\n"
124+
+ " \"Content-Length\": \"45\",\n"
125+
+ " \"Content-Type\": \"application/json\",\n"
126+
+ " \"Host\": \"i76bfh111.execute-api.eu-west-3.amazonaws.com\",\n"
127+
+ " \"User-Agent\": \"curl/7.79.1\",\n"
128+
+ " \"X-Amzn-Trace-Id\": \"Root=1-64087690-2151375b219d3ba3389ea84e\",\n"
129+
+ " \"X-Forwarded-For\": \"109.210.252.44\",\n"
130+
+ " \"X-Forwarded-Port\": \"443\",\n"
131+
+ " \"X-Forwarded-Proto\": \"https\",\n"
132+
+ " \"accept\": \"*/*\"\n"
133+
+ " },\n"
134+
+ " \"queryStringParameters\": {\n"
135+
+ " \"abc\": \"xyz\",\n"
136+
+ " \"parameter1\": \"value2\"\n"
137+
+ " },\n"
138+
+ " \"multiValueQueryStringParameters\": {\n"
139+
+ " \"abc\": [\n"
140+
+ " \"xyz\"\n"
141+
+ " ],\n"
142+
+ " \"parameter1\": [\n"
143+
+ " \"value1\",\n"
144+
+ " \"value2\"\n"
145+
+ " ]\n"
146+
+ " },\n"
147+
+ " \"requestContext\": {\n"
148+
+ " \"accountId\": \"123456789098\",\n"
149+
+ " \"apiId\": \"i76bfhczs0\",\n"
150+
+ " \"domainName\": \"i76bfhc111.execute-api.eu-west-3.amazonaws.com\",\n"
151+
+ " \"domainPrefix\": \"i76bfhczs0\",\n"
152+
+ " \"extendedRequestId\": \"Bdd2ngt5iGYEMIg=\",\n"
153+
+ " \"httpMethod\": \"POST\",\n"
154+
+ " \"path\": \"/pets\",\n"
155+
+ " \"protocol\": \"HTTP/1.1\",\n"
156+
+ " \"requestId\": \"Bdd2ngt5iGYEMIg=\",\n"
157+
+ " \"requestTime\": \"08/Mar/2023:11:50:40 +0000\",\n"
158+
+ " \"requestTimeEpoch\": 1678276240455,\n"
159+
+ " \"resourceId\": \"$default\",\n"
160+
+ " \"resourcePath\": \"$default\",\n"
161+
+ " \"stage\": \"$default\"\n"
162+
+ " },\n"
163+
+ " \"pathParameters\": null,\n"
164+
+ " \"stageVariables\": null,\n"
165+
+ " \"body\": \"{\\\"name\\\":\\\"bob\\\"}\",\n"
166+
+ " \"isBase64Encoded\": false\n"
167+
+ "}";
168+
118169
private static String API_GATEWAY_EVENT_V2 = "{\n" +
119170
" \"version\": \"2.0\",\n" +
120171
" \"routeKey\": \"$default\",\n" +
@@ -215,7 +266,7 @@ public class AwsSpringHttpProcessingUtilsTests {
215266
private final ObjectMapper mapper = new ObjectMapper();
216267

217268
public static Collection<String> data() {
218-
return Arrays.asList(new String[]{API_GATEWAY_EVENT, API_GATEWAY_EVENT_V2, ALB_EVENT});
269+
return Arrays.asList(new String[]{API_GATEWAY_EVENT, API_GATEWAY_EVENT_WITHOUT_MULTIVALUE_HEADERS, API_GATEWAY_EVENT_V2, ALB_EVENT});
219270
}
220271

221272
@MethodSource("data")

0 commit comments

Comments
 (0)