This commit is contained in:
Looly
2022-05-31 21:33:22 +08:00
parent 811c1f1025
commit a60f20f241
5 changed files with 48 additions and 6 deletions

View File

@@ -204,4 +204,10 @@ public class HttpRequestTest {
final HttpRequest httpRequest = new HttpRequest(urlBuilder);
httpRequest.setMethod(Method.GET).execute();
}
@Test
@Ignore
public void getCookieTest(){
HttpRequest.get("http://localhost:8888/getCookier").execute();
}
}

View File

@@ -1,12 +1,16 @@
package cn.hutool.http.server;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.net.multipart.UploadFile;
import cn.hutool.http.ContentType;
import cn.hutool.http.Header;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import java.net.HttpCookie;
public class SimpleServerTest {
public static void main(final String[] args) {
@@ -54,7 +58,13 @@ public class SimpleServerTest {
.addAction("test/zeroStr", (req, res)-> {
res.write("0");
Console.log("Write 0 OK");
})
}).addAction("/getCookie", ((request, response) -> {
response.setHeader(Header.SET_COOKIE.toString(),
ListUtil.of(
new HttpCookie("cc", "123").toString(),
new HttpCookie("cc", "abc").toString()));
response.write("Cookie ok");
}))
.start();
}
}