All Downloads are FREE. Search and download functionalities are using the official Maven repository.

invirt.http4k.bindings.kt Maven / Gradle / Ivy

There is a newer version: 0.10.11
Show newest version
package invirt.http4k

import org.http4k.core.Method
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.routing.RoutingHttpHandler
import org.http4k.routing.bind

@Suppress("ktlint:standard:function-naming")
infix fun String.GET(handler: (Request) -> Response): RoutingHttpHandler {
    return this bind Method.GET to { request ->
        handler(request)
    }
}

@Suppress("ktlint:standard:function-naming")
infix fun String.POST(handler: (Request) -> Response): RoutingHttpHandler {
    return this bind Method.POST to { request ->
        handler(request)
    }
}

@Suppress("ktlint:standard:function-naming")
infix fun String.PUT(handler: (Request) -> Response): RoutingHttpHandler {
    return this bind Method.PUT to { request ->
        handler(request)
    }
}

@Suppress("ktlint:standard:function-naming")
infix fun String.DELETE(handler: (Request) -> Response): RoutingHttpHandler {
    return this bind Method.DELETE to { request ->
        handler(request)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy