We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1.1.2
netty
jvm 1.8 os windows 10 kotlin 1.3.20
I use html dsl create form, but it can not find the action url this is code
Application.kt
@KtorExperimentalLocationsAPI @Location("/user") class User { @Location("/login") data class UserLogin(val username: String, val password: String) @Location("/register") data class UserRegister(val username: String, val password: String) } fun main(args: Array<String>): Unit = io.ktor.server.netty.EngineMain.main(args) @KtorExperimentalLocationsAPI @Suppress("unused") // Referenced in application.conf @kotlin.jvm.JvmOverloads fun Application.module(testing: Boolean = false) { install(Locations) routing { user() get("/") { call.respondHtml { head { title { +"Ktor 入门" } } body { a { href = "/register" +"注册" } form("/user/login", method = FormMethod.post, encType = FormEncType.multipartFormData) { input { type = InputType.text name = "username" } br input { type = InputType.password value = "" name = "password" } br input { type = InputType.submit value = "login" } } } } } get("/login") { call.respond("success") } } }
@KtorExperimentalLocationsAPI fun Route.user() { post<User.UserLogin> { call.respondText("登录成功") } post<User.UserRegister> { user -> run { call.respondText("用户 ${user.username} ${user.password}") } } }
in browers ,can not find the url
but i used the .http file , can get response
The text was updated successfully, but these errors were encountered:
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Sorry, something went wrong.
No branches or pull requests
Ktor Version
1.1.2
Ktor Engine Used(client or server and name)
netty
JVM Version, Operating System and Relevant Context
jvm 1.8
os windows 10
kotlin 1.3.20
Feedback
I use html dsl create form, but it can not find the action url
this is code
Application.kt
in browers ,can not find the url
but i used the .http file , can get response
The text was updated successfully, but these errors were encountered: