-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative Ktor Raise DSL #3581
base: main
Are you sure you want to change the base?
Conversation
At the moment, this PR is only addressing one "con" of the existing API, which is the reliance on Raising
|
…row-ktor-api # Conflicts: # arrow-libs/integrations/arrow-raise-ktor-server/build.gradle.kts
I've now replaced the existing You could now achieve the above example with something like: routing {
getOrRaise("/users/{userId?}") {
val userId = call.pathParameters["userId"] ?: raiseBadRequest("userId not specified")
withError(::handleError) {
userService.lookupUser(userId) ?: raise(HttpStatusCode.NotFound)
}
}
} |
I'm wary `Response` is potentially too non-specific, however `RoutingResponse` clashes with `io.ktor.server.routing.RoutingResponse`
Not complete by any stretch but hopefully enough to start any discussion.