CapturedRequest

class CapturedRequest<P : Any>(request: ApplicationRequest, type: KClass<P>)(source)

Represents an HTTP request that has been captured and provides utilities to access the request's body and its string representation.

Author

Konstantin Pavlov

Parameters

P

The type of the request payload.

Constructors

Link copied to clipboard
constructor(request: ApplicationRequest, type: KClass<P>)

Functions

Link copied to clipboard
suspend fun body(): P

Returns the parsed request body as P, suspending if the body has not yet been read.

Link copied to clipboard
suspend fun bodyAsString(): String?

Returns the raw request body as a String, suspending if the body has not yet been read.