Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response header 同时配置content-type & content-length, 响应卡住 #345

Open
iamJunPan opened this issue Mar 20, 2024 · 0 comments
Open

Comments

@iamJunPan
Copy link

iamJunPan commented Mar 20, 2024

复现场景 (两种设置response方式均会卡住,没有响应值)

    @Test
    public void testHeaders() throws Exception {
        HttpServer server = httpServer(12306);
        server.response(header("content-type", "application/json"), header("content-length", "100"));
        
        //server.response(header("content-type", "application/json")).response(header("content-length", "100"));
        running(server, () -> {
            Request request = Request.Post("http://localhost:12306/");
            HttpResponse response = request.execute().returnResponse();
            System.out.print("response:" + response + "\n");
            List<String> contentTypeValues = HttpResponseUtils.getHeader(response, "content-type");
            List<String> contentLengthValues = HttpResponseUtils.getHeader(response, "content-length");
            System.out.print(contentLengthValues);
            System.out.print(contentTypeValues);
            assertEquals("application/json", contentTypeValues.get(0));
            assertEquals("100", contentTypeValues.get(0));
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant