HTTP 1.1 503 Service Unavailable

在调用第三方接口的时候,获取返回的状态的方法: 创建post请求,

然后通过下面一行代码 执行post请求

CloseableHttpResponse response = (CloseableHttpResponse) httpclient.execute(httppost);

打印请求返回状态

System.out.println(response.getStatusLine());

返回结果

HTTP 1.1 503 Service Unavailable

百度了两个小时左右 有的说程序写错了。有的说阻塞。有的说应用池满了。。。

我的这种属于请求头不完整, 在借助Burp Suite工具对请求进行分析以后,拼接成完整的访问头部,返回值就正常了。

HTTP 1.1 503 Service Unavailable_第1张图片

类似:httppost.setHeader("Content-Type", "application/json");

你可能感兴趣的:(记录)