Handler for requests to Lambda function.
| 13 | * Handler for requests to Lambda function. |
| 14 | */ |
| 15 | public class App implements RequestHandler<Object, APIGatewayV2HTTPResponse> { |
| 16 | private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); |
| 17 | |
| 18 | public APIGatewayV2HTTPResponse handleRequest(final Object input, final Context context) { |
| 19 | try { |
| 20 | HashMap<String, String> headers = new HashMap<>(); |
| 21 | headers.put("Content-Type", "application/json"); |
| 22 | return APIGatewayV2HTTPResponse.builder() |
| 23 | .withStatusCode(200) |
| 24 | .withHeaders(headers) |
| 25 | .withIsBase64Encoded(false) |
| 26 | .withBody(OBJECT_MAPPER.writeValueAsString(input)) |
| 27 | .build(); |
| 28 | } catch (JsonProcessingException e) { |
| 29 | throw new RuntimeException(e); |
| 30 | } |
| 31 | } |
| 32 | } |
nothing calls this directly
no outgoing calls
no test coverage detected