exchangeHTML

fun exchangeHTML(request: MutableHttpRequest<Any>, accept: String? = "text/html,*/*", status: Int? = 200, block: HttpResponse<Any>.(Document) -> Unit? = null): HttpResponse<Any>

Syntactic sugar to exchange a request with the active Elide server which is expected to produce HTML; assertions are run against the response (expected status, content-type/encoding/length, etc), and then the page is parsed with Jsoup and handed to block for additional testing.

If any step of the parsing or fetching process fails, the test invoking this method also fails (unless such errors are caught by the invoker).

Return

HTTP response from the server.

Parameters

request

HTTP request to submit to the current Elide server.

accept

Accept value to append to the response; if null is passed, nothing is appended.

status

Expected HTTP status for the response.

block

Block of assertions to additionally perform, with access to the parsed page.

See also

which allows an arbitrary response body type.