Skip to content

Instantly share code, notes, and snippets.

@scap1784
Created November 17, 2017 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scap1784/23dcaee099899acd564ef4e64ee27710 to your computer and use it in GitHub Desktop.
Save scap1784/23dcaee099899acd564ef4e64ee27710 to your computer and use it in GitHub Desktop.
meta fails because to generates a tuple.
fun provideServer() : RoutingHttpHandler {
fun ping(): HttpHandler = {
Response(OK).with(
Body.string(TEXT_PLAIN).toLens() of "pong"
)
}
val filter: Filter = ResponseFilters.ReportRouteLatency(Clock.systemUTC(), { name: String, latency: Duration ->
println(name + " took " + latency)
})
val security = ApiKey(Query.int().required("apiKey"), {
println("foo" + (it == 42))
it == 42
})
val contract = contract(OpenApi(ApiInfo("the greatest api", "v1.0"), Jackson), "/docs/swagger.json", security,
("/ping")
bindContract GET
to ::ping
meta RouteMeta("ping", "Are we still there?").returning("Pong" to OK)
)
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment