I am trying to learn Ktor, when responding to a GET request, I found that the trailing slash is treated as two routes, for example:
/greet?name=john
/greet/?name=john
Is it possible to define one route for the above two URLs, which is to handle trailing slash automatically?
In your Application.module() or Application.configureRouting() add this:
install(IgnoreTrailingSlash)
You can use the IgnoreTrailingSlash plugin to solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With