@Override
    public HttpServletRequest readRequest(HttpApiV2ProxyRequest request, SecurityContext securityContext, Context lambdaContext, ContainerConfig config) throws InvalidRequestEventException {
        if (request.getRequestContext() == null || request.getRequestContext().getHttp().getMethod() == null || request.getRequestContext().getHttp().getMethod().equals("")) {
            throw new InvalidRequestEventException(INVALID_REQUEST_ERROR);
        }

        // clean out the request path based on the container config
        request.setRawPath(stripBasePath(request.getRawPath(), config));

        AwsHttpApiV2ProxyHttpServletRequest servletRequest = new AwsHttpApiV2ProxyHttpServletRequest(request, lambdaContext, securityContext, config);
        servletRequest.setAttribute(HTTP_API_CONTEXT_PROPERTY, request.getRequestContext());
        servletRequest.setAttribute(HTTP_API_STAGE_VARS_PROPERTY, request.getStageVariables());
        servletRequest.setAttribute(HTTP_API_EVENT_PROPERTY, request);
        servletRequest.setAttribute(LAMBDA_CONTEXT_PROPERTY, lambdaContext);
        servletRequest.setAttribute(JAX_SECURITY_CONTEXT_PROPERTY, securityContext);

        return servletRequest;
    }
@Test
    void baseRequest_read_populatesSuccessfully() {
        HttpApiV2ProxyRequest req = new AwsProxyRequestBuilder("/hello", "GET")
                .referer("localhost")
                .userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36")
                .queryString("param1", "value1")
                .header("custom", "value")
                .cookie("cookey", "cooval")
                .apiId("test").toHttpApiV2Request();
        AwsHttpApiV2HttpServletRequestReader reader = new AwsHttpApiV2HttpServletRequestReader();
        try {
            HttpServletRequest servletRequest = reader.readRequest(req, null, null, LambdaContainerHandler.getContainerConfig());
            assertEquals("/hello", servletRequest.getPathInfo());
            assertEquals("value1", servletRequest.getParameter("param1"));
            assertEquals("value", servletRequest.getHeader("CUSTOM"));
            assertEquals("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36", servletRequest.getHeader(HttpHeaders.USER_AGENT));

            assertNotNull(servletRequest.getCookies());
            assertEquals(1, servletRequest.getCookies().length);
            assertEquals("cookey", servletRequest.getCookies()[0].getName());
            assertEquals("cooval", servletRequest.getCookies()[0].getValue());

            assertNotNull(servletRequest.getAttribute(AwsHttpApiV2HttpServletRequestReader.HTTP_API_CONTEXT_PROPERTY));
            assertEquals("test",
                    ((HttpApiV2ProxyRequestContext)servletRequest.getAttribute(AwsHttpApiV2HttpServletRequestReader.HTTP_API_CONTEXT_PROPERTY)).getApiId());
        } catch (InvalidRequestEventException e) {
            e.printStackTrace();
            fail("Could not read request");
        }
    }