Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.35 KB

ktor.md

File metadata and controls

28 lines (20 loc) · 1.35 KB

Ktor Matchers

Matchers for Ktor are provided by the kotest-assertions-ktor module.

Test Application Response

The following matchers are used when testing via the ktor server testkit.

Matcher Description
shouldHaveStatus(HttpStatusCode) Tests that the response had the given http status code
shouldHaveContent(content) Tests that the response has the given body
shouldHaveContentType(ContentType) Tests that the response has the given Content Type
shouldHaveHeader(name, value) Tests that the response included the given name=value header
shouldHaveCookie(name, value) Tests that the response included the given cookie

HttpResponse

The following matchers can be used against responses from the ktor http client.

Matcher Description
shouldHaveStatus(HttpStatusCode) Tests that the response had the given http status code
shouldHaveContentType(ContentType) Tests that the response has the given Content Type
shouldHaveHeader(name, value) Tests that the response included the given name=value header
shouldHaveVersion(HttpProtocolVersion) Tests that the response used the given protocol version