File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
aws-serverless-java-container-jersey/src/test/java/com/amazonaws/serverless/proxy/jersey Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 1313package com .amazonaws .serverless .proxy .jersey ;
1414
1515
16+ import com .amazonaws .serverless .proxy .internal .LambdaContainerHandler ;
1617import com .amazonaws .serverless .proxy .model .AwsProxyRequest ;
1718import com .amazonaws .serverless .proxy .model .AwsProxyResponse ;
1819import com .amazonaws .serverless .proxy .internal .servlet .AwsServletContext ;
@@ -239,6 +240,21 @@ public void stripBasePath_route_shouldRouteCorrectly() {
239240 handler .stripBasePath ("" );
240241 }
241242
243+ @ Test
244+ public void stripBasePath_route_shouldReturn404WithStageAsContext () {
245+ AwsProxyRequest request = new AwsProxyRequestBuilder ("/custompath/echo/status-code" , "GET" )
246+ .stage ("prod" )
247+ .json ()
248+ .queryString ("status" , "201" )
249+ .build ();
250+ handler .stripBasePath ("/custompath" );
251+ LambdaContainerHandler .getContainerConfig ().setUseStageAsServletContext (true );
252+ AwsProxyResponse output = handler .proxy (request , lambdaContext );
253+ assertEquals (404 , output .getStatusCode ());
254+ handler .stripBasePath ("" );
255+ LambdaContainerHandler .getContainerConfig ().setUseStageAsServletContext (false );
256+ }
257+
242258 @ Test
243259 public void stripBasePath_route_shouldReturn404 () {
244260 AwsProxyRequest request = new AwsProxyRequestBuilder ("/custompath/echo/status-code" , "GET" )
You can’t perform that action at this time.
0 commit comments