@Test public void createContainerRequest_NoBodyGiven_ShouldUseEmptyBaos() { ServiceRequestAndLambdaContext request = createMinimalRequest(); JRestlessContainerRequest containerRequest = serviceHandler.createContainerRequest(request); InputStream is = containerRequest.getEntityStream(); assertEquals(ByteArrayInputStream.class, is.getClass()); assertArrayEquals(new byte[0], toBytes((ByteArrayInputStream) is)); }
@Override protected JRestlessContainerRequest createContainerRequest(ServiceRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); ServiceRequest request = requireNonNull(requestAndLambdaContext.getServiceRequest()); 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); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, request.getHeaders()); }
ServiceRequestHandler extends SimpleRequestHandler<ServiceRequestAndLambdaContext, ServiceResponse> { @Override protected JRestlessContainerRequest createContainerRequest(ServiceRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); ServiceRequest request = requireNonNull(requestAndLambdaContext.getServiceRequest()); 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); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, request.getHeaders()); } }
ServiceRequestHandler extends SimpleRequestHandler<ServiceRequestAndLambdaContext, ServiceResponse> { @Override protected JRestlessContainerRequest createContainerRequest(ServiceRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); ServiceRequest request = requireNonNull(requestAndLambdaContext.getServiceRequest()); 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); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, request.getHeaders()); } protected  ServiceRequestHandler(); }
ServiceRequestHandler extends SimpleRequestHandler<ServiceRequestAndLambdaContext, ServiceResponse> { @Override protected JRestlessContainerRequest createContainerRequest(ServiceRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); ServiceRequest request = requireNonNull(requestAndLambdaContext.getServiceRequest()); 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); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, request.getHeaders()); } protected  ServiceRequestHandler();  }
ServiceRequestHandler extends SimpleRequestHandler<ServiceRequestAndLambdaContext, ServiceResponse> { @Override protected JRestlessContainerRequest createContainerRequest(ServiceRequestAndLambdaContext requestAndLambdaContext) { requireNonNull(requestAndLambdaContext); ServiceRequest request = requireNonNull(requestAndLambdaContext.getServiceRequest()); 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); return new DefaultJRestlessContainerRequest(requestAndBaseUri, request.getHttpMethod(), entityStream, request.getHeaders()); } protected  ServiceRequestHandler();   }