exchange

fun exchange(request: MutableHttpRequest<Any>, status: Int? = 200, block: HttpResponse<Any>.() -> Unit? = null): HttpResponse<Any>

Exchange a test request with the current server, expecting status as an HTTP return status; after executing the request to obtain the response, block is executed (if provided) to perform additional assertions on the response.

In this case, no response payload type is provided, and the request payload type is also generic. If you would like to decode the response and test against it, see other variants of this method.

Return

HTTP response from the server.

Parameters

request

HTTP request to submit to the current Elide server.

status

Expected HTTP status for the response.

block

Block of assertions to additionally perform.

See also

which allows a response body type.


fun <P : Any, R : Any> exchange(request: MutableHttpRequest<P>, status: Int? = 200, responseType: Class<R>, block: HttpResponse<R>.() -> Unit? = null): HttpResponse<R>

Exchange a test request with the current server, expecting status as an HTTP return status; after executing the request to obtain the response, block is executed (if provided) to perform additional assertions on the response.

Return

HTTP response from the server.

Parameters

request

HTTP request to submit to the current Elide server.

status

Expected HTTP status for the response.

responseType

Type of the response payload.

block

Block of assertions to additionally perform.