Skip to content

Instantly share code, notes, and snippets.

@s1monw1
Created October 7, 2022 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s1monw1/0eae978ac225e6712a71f0c53c1e0af3 to your computer and use it in GitHub Desktop.
Save s1monw1/0eae978ac225e6712a71f0c53c1e0af3 to your computer and use it in GitHub Desktop.
val addExtraHeaderFilter = Filter { next ->
{
next(it).header("x-extra-header", "some value")
}
}
@Test
fun adds_a_special_header() {
val handler: HttpHandler = addExtraHeaderFilter.then { Response(OK) }
val response: Response = handler(Request(GET, "/echo"))
assertThat(response, hasStatus(OK)
.and(hasHeader("x-extra-header", "some value")))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment