mirror of
https://github.com/corda/corda.git
synced 2025-05-03 01:03:18 +00:00
throwing clearer error message when not supported 301 response code is used (#6296)
This commit is contained in:
parent
9f2bd1dcae
commit
14b9bc2c53
@ -33,6 +33,7 @@ import java.lang.reflect.Member
|
|||||||
import java.lang.reflect.Modifier
|
import java.lang.reflect.Modifier
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
|
import java.net.HttpURLConnection.HTTP_MOVED_PERM
|
||||||
import java.net.HttpURLConnection.HTTP_OK
|
import java.net.HttpURLConnection.HTTP_OK
|
||||||
import java.net.Proxy
|
import java.net.Proxy
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
@ -478,8 +479,12 @@ fun URL.post(serializedData: OpaqueBytes, vararg properties: Pair<String, String
|
|||||||
@DeleteForDJVM
|
@DeleteForDJVM
|
||||||
fun HttpURLConnection.checkOkResponse() {
|
fun HttpURLConnection.checkOkResponse() {
|
||||||
if (responseCode != HTTP_OK) {
|
if (responseCode != HTTP_OK) {
|
||||||
|
if(responseCode == HTTP_MOVED_PERM) {
|
||||||
|
throw IOException("Response Code $responseCode Moved Permanently cannot be used here. We only accept $HTTP_OK responses.")
|
||||||
|
} else {
|
||||||
throw IOException("Response Code $responseCode: $errorMessage")
|
throw IOException("Response Code $responseCode: $errorMessage")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteForDJVM
|
@DeleteForDJVM
|
||||||
|
Loading…
x
Reference in New Issue
Block a user