jsoup post方式请求接口错误“HTTP error fetching URL. Status=400”解决方法

错误信息:

Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400, URL=“xxxxxxx”

折腾了很久才找到解决方法:

 .ignoreContentType(true)
 .ignoreHttpErrors(true)

添加上面两个属性问题解决!get()的时候一般不会有问题,但是如果你是post方式提交数据到接口,报错的概率相当高,建议

不管是post,还是get,均开启这两个参数,万无一失!

猜你喜欢

转载自blog.csdn.net/wh445306/article/details/112727697