Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
openrs2/http/src/main/kotlin/org/openrs2/http/HttpResponseExtensions.kt

13 lines
397 B

package org.openrs2.http
import java.io.IOException
import java.net.http.HttpResponse
private val DEFAULT_EXPECTED_STATUS_CODES = setOf(200)
public fun <T> HttpResponse<T>.checkStatusCode(expectedStatusCodes: Set<Int> = DEFAULT_EXPECTED_STATUS_CODES) {
val status = statusCode()
if (status !in expectedStatusCodes) {
throw IOException("Unexpected status code: $status")
}
}