Various technical articles, IT-related tutorials, software information, and development journals
Saturday, June 22, 2019
Ktor's default response is 404 even if there's a route
I'm using the Ktor web server/framework to write a web service in Kotlin. I added a handler for a certain route, put some code in it, but found that clients got a 404 error when accessing that path. Apparently the problem was that, since I didn't need to send any data to the client when handling that request, I never used one of the response methods on call - the status code defaulted to 404. Setting the status code with call.response.status produced my expected behavior.
Labels:
misc
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment