We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 220fb1f commit d8f9fb6Copy full SHA for d8f9fb6
1 file changed
util/okhttp-kts/src/main/kotlin/okhttp-ktx.kt
@@ -199,7 +199,8 @@ fun OkHttpClient.postForm(
199
*/
200
fun Response.checkSuccess() {
201
if (code !in 200..399) {
202
- throw HttpStatusCodeException(code, message)
+ readText(skipStatusCheck = true)
203
+ throw HttpStatusCodeException(code, message, this)
204
}
205
val location = getLocationUnchecked()
206
if (location != null) {
@@ -211,7 +212,7 @@ fun Response.checkSuccess() {
211
212
213
214
-class HttpStatusCodeException(code: Int, message: String) : IllegalStateException("$code $message")
215
+class HttpStatusCodeException(val code: Int, message: String, val response: Response) : IllegalStateException("$code $message")
216
217
/**
218
* Retrieves the redirect location from the HTTP response.
0 commit comments