Package-level declarations

Types

Link copied to clipboard

The body of a request or response.

Link copied to clipboard
class ContentDisposition(val disposition: String, val parameters: Map<String, String> = mapOf())

Extra information about how content should be treated / displayed.

Link copied to clipboard
interface ContentSource

Interface for a body class that allows users to consume its body content.

Link copied to clipboard
Link copied to clipboard
interface Multipart

Represents all relevant information associated with a multipart request.

Link copied to clipboard
Link copied to clipboard
class MutableRequest(val connection: Request.Connection, var method: HttpMethod, params: Map<String, String>, queryParams: Map<String, String>, headers: Map<String, List<String>>, cookies: Map<String, String>, var body: Body?, val data: MutableData = MutableData()) : Request
Link copied to clipboard
interface Request

Information passed into an API endpoint from the client.

Link copied to clipboard
class Response

Data to send back to the client after it makes a request to an API endpoint.

Functions

Link copied to clipboard
suspend fun ContentSource.bytes(limit: Int? = null): ByteArray

Convenience method to convert a body's content into a raw byte array.

fun Body.Companion.bytes(bytes: ByteArray, contentType: String = "application/octet-stream"): Body
Link copied to clipboard
suspend fun Multipart.forEachPart(autoClose: Boolean = true, block: suspend MultipartScope.(Multipart.Part) -> Unit)

A convenience method that wraps Multipart.readNextPart so you don't have to collect it yourself.

Link copied to clipboard
fun Body.Companion.json(text: String, contentType: String = "application/json"): Body
Link copied to clipboard
suspend fun Request.readBodyText(): String?
Link copied to clipboard
fun Response.setAsRedirect(newPath: String, status: Int = 307, isApiPath: Boolean = false)

Set this to a response that tells the client that the requested resource has moved to a new location.

Link copied to clipboard

Convenience method for setting the body to a text value.

Link copied to clipboard

Convert this byte source into an InputStream.

fun Body.Companion.stream(inputStream: InputStream, contentType: String = "application/octet-stream"): Body
Link copied to clipboard
suspend fun ContentSource.text(charset: Charset = contentType.parseCharsetFromContentType(), limit: Int? = null): String

Convenience method to convert a body's content into a UTF-8 string.

fun Body.Companion.text(text: String, charset: Charset = Charsets.UTF_8, contentType: String = "text/plain; charset="): Body