Open iamJunPan opened 5 months ago
复现场景 (两种设置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)); }); }
复现场景 (两种设置response方式均会卡住,没有响应值) @Test public void testHeaders() throws Exception { HttpServer server = httpServer(12306); server.response(header("content-type", "application/json"), header("content-length", "100"));