Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,33 @@ private static HttpServletRequest generateRequest1(String request, Context lambd
SecurityContextWriter securityWriter, ObjectMapper mapper, ServletContext servletContext) {
AwsProxyRequest v1Request = readValue(request, AwsProxyRequest.class, mapper);

// Use AWS container's servlet request instead of Spring Cloud Function's
AwsProxyHttpServletRequest httpServletRequest = new AwsProxyHttpServletRequest(v1Request, lambdaContext, securityWriter.writeSecurityContext(v1Request, lambdaContext));
httpServletRequest.setServletContext(servletContext);
return httpServletRequest;
ServerlessHttpServletRequest httpRequest = new ServerlessHttpServletRequest(servletContext, v1Request.getHttpMethod(), v1Request.getPath());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between AwsProxyHttpServletRequest and ServerlessHttpServletRequest? I guess they're both HttpServletRequests but could in theory have different behavior, right? This might be a basic question I'm just not very familiar.


populateQueryStringParametersV1(v1Request, httpRequest);
populateMultiValueQueryStringParametersV1(v1Request, httpRequest);

if (v1Request.getMultiValueHeaders() != null) {
MultiValueMapAdapter headers = new MultiValueMapAdapter(v1Request.getMultiValueHeaders());
httpRequest.setHeaders(headers);
}
populateContentAndContentType(
v1Request.getBody(),
v1Request.getMultiValueHeaders().getFirst(HttpHeaders.CONTENT_TYPE),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could getMultiValueHeaders be null? There's a check for it above and this code runs regardless.

v1Request.isBase64Encoded(),
httpRequest
);
if (v1Request.getRequestContext() != null) {
httpRequest.setAttribute(RequestReader.API_GATEWAY_CONTEXT_PROPERTY, v1Request.getRequestContext());
httpRequest.setAttribute(RequestReader.ALB_CONTEXT_PROPERTY, v1Request.getRequestContext().getElb());
}
httpRequest.setAttribute(RequestReader.API_GATEWAY_STAGE_VARS_PROPERTY, v1Request.getStageVariables());
httpRequest.setAttribute(RequestReader.API_GATEWAY_EVENT_PROPERTY, v1Request);
httpRequest.setAttribute(RequestReader.LAMBDA_CONTEXT_PROPERTY, lambdaContext);
httpRequest.setAttribute(RequestReader.JAX_SECURITY_CONTEXT_PROPERTY,
securityWriter.writeSecurityContext(v1Request, lambdaContext));
return httpRequest;
}




Expand Down
Loading