Skip to content

Commit 4fec449

Browse files
committed
Attempting to replicate cookie issue reported in #274
1 parent 6e4bc18 commit 4fec449

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class HelloWorldSparkTest {
3535
private static final String COOKIE_DOMAIN = "mydomain.com";
3636
private static final String COOKIE_PATH = "/";
3737

38+
private static final String READ_COOKIE_NAME = "customCookie";
39+
3840
private static SparkLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> handler;
3941

4042
private boolean isAlb;
@@ -122,6 +124,13 @@ public void rootResource_basicRequest_expectSuccess() {
122124
assertEquals(BODY_TEXT_RESPONSE, response.getBody());
123125
}
124126

127+
@Test
128+
public void readCookie_customDomainName_expectValidCookie() {
129+
AwsProxyRequest req = getRequestBuilder().method("GET").path("/cookie-read").cookie(READ_COOKIE_NAME, "test").build();
130+
AwsProxyResponse response = handler.proxy(req, new MockLambdaContext());
131+
assertEquals("test", response.getBody());
132+
}
133+
125134
private static void configureRoutes() {
126135
get("/", (req, res) -> {
127136
res.status(200);
@@ -154,5 +163,7 @@ private static void configureRoutes() {
154163
res.raw().addCookie(testCookie2);
155164
return BODY_TEXT_RESPONSE;
156165
});
166+
167+
get("/cookie-read", (req, res) -> req.cookie(READ_COOKIE_NAME));
157168
}
158169
}

0 commit comments

Comments
 (0)