我正在做这个请求:
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "username=George&password=toto");
Request request = new Request.Builder()
.url("http://localhost:8080/login")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
try {
Response response = client.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
但是如何获取服务器归还给我的cookie ?我只是想将它存储在一个 String 变量中(这就是全部)
提前谢谢!