@Test public void createContainerRequest_HeadersGiven_ShouldUseHeaders() { GatewayRequestAndLambdaContext request = createMinimalRequest(); ((DefaultGatewayRequest) request.getGatewayRequest()).setHeaders(ImmutableMap.of("a_k", "a_v", "b_k", "b_v")); JRestlessContainerRequest containerRequest = gatewayHandler.createContainerRequest(request); assertEquals(ImmutableMap.of("a_k", singletonList("a_v"), "b_k", singletonList("b_v")), containerRequest.getHeaders()); }
@Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } protected  GatewayRequestHandler(); }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } protected  GatewayRequestHandler();  }
GatewayRequestHandler extends SimpleRequestHandler<GatewayRequestAndLambdaContext, GatewayResponse> { @Override protected JRestlessContainerRequest createContainerRequest(GatewayRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); GatewayRequest request = requestAndLambdaContext.getGatewayRequest(); requireNonNull(request); requireNonNull(request.getPath()); String body = request.getBody(); InputStream entityStream; if (body != null) { entityStream = new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)); } else { entityStream = new ByteArrayInputStream(new byte[0]); } RequestAndBaseUri requestAndBaseUri = getRequestAndBaseUri(requestAndLambdaContext); LOG.trace("passing baseUri='{}' and requestUri='{}' to the container", requestAndBaseUri.getBaseUri(), requestAndBaseUri.getRequestUri()); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, HeaderUtils.expandHeaders(request.getHeaders())); } protected  GatewayRequestHandler();   }