Changeset View
Changeset View
Standalone View
Standalone View
src/main/java/net/wildfyre/http/Request.kt
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | constructor(private val method: Method, private val address: String) { | ||||
*/ | */ | ||||
@Throws(IssueInTransferException::class) | @Throws(IssueInTransferException::class) | ||||
fun getJson(): JsonValue { | fun getJson(): JsonValue { | ||||
headers["Accept"] = DataType.JSON.toString() | headers["Accept"] = DataType.JSON.toString() | ||||
return readJson(getInputStream(send())) | return readJson(getInputStream(send())) | ||||
} | } | ||||
/** | /** | ||||
* Requests a raw response from the server, and returns it. | |||||
* @return The raw response from the server, wrapped in an InputStream. | |||||
*/ | |||||
@Throws(IssueInTransferException::class) | |||||
fun getRaw(): InputStream { | |||||
return getInputStream(send()) | |||||
} | |||||
/** | |||||
* Calls [getJson] and performs a cast to [JsonObject], for convenience. | * Calls [getJson] and performs a cast to [JsonObject], for convenience. | ||||
*/ | */ | ||||
fun getJsonObject(): JsonObject = getJson() as JsonObject | fun getJsonObject(): JsonObject = getJson() as JsonObject | ||||
/** | /** | ||||
* Calls [getJson] and performs a cast to [JsonArray], for convenience. | * Calls [getJson] and performs a cast to [JsonArray], for convenience. | ||||
*/ | */ | ||||
fun getJsonArray(): JsonArray = getJson() as JsonArray | fun getJsonArray(): JsonArray = getJson() as JsonArray | ||||
▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines |