HTTP 405错误

0

这个错误就是方法不允许,最常见的就是只能POST请求使用GET请求。

java.io.IOException: Server returned HTTP response code: 405 for URL: https://www.acgist.com/xxxx
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1913)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:245)

还有一种情况也会出现这个问题,就是GET请求,但是调用了connection.getOutputStream()