如何查看正在发送的实际HttpPost请求
问题描述:
我的代码中存在一些错误,我无法确切知道它发生了什么。如何查看正在发送的实际HttpPost请求
我的代码看起来大致是这样的......
data.add(firstName);
data.add(lastName);
data.add(email);
data.add(country);
data.add(currency);
data.add(phone);
String result; // results of Http execution
try {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(data);
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
请求没有得到我预期的响应(即一个我得到的,当我使用卷曲。
我想看看该httpClient
正在确切的请求有没有办法做到这一点
答
可以打印所有请求的详细信息如下:?
HttpPost post = new HttpPost();
post.getAllHeaders();
post.getMethod(); // Post or get request
post.getParams(); // Returns params
post.getURI(); // Current Uri called
一旦你得到响应,
response.getAllHeaders();
httpResponse.getStatusLine().getStatusCode(); // response status
你想看到像params中,请求URL等什么? – 2014-09-22 09:58:05