Skip to content

[BUG] schema: invalid path "username" #2456

Open
@baiyuxiong

Description

@baiyuxiong

Describe the bug
Browser shows:
schema: invalid path "username"schema: invalid path "username"

To Reproduce
Steps to reproduce the behavior:
codes as follow:

//main.go
user := mvc.New(app.Party("/my"))
	user.Register(
		userService,
		sessManager.Start,
	)
	user.Handle(new(controller.MyController))

//my_controller.go
type MyController struct {
	Ctx     iris.Context
	Service service.UserService
	Session *sessions.Session
}

func (c *MyController) GetLogin() mvc.Result {
	return mvc.View{
		Name: "my/login.html",
	}
}

type loginForm struct {
	Username string `form:"username"`
}

func (c *MyController) PostLogin(form loginForm) mvc.Result {
	fmt.Println(form.Username)
	return mvc.Response{
		Path: "/my/login",
	}
}

//my/login.html
<form action="/my/login" method="POST" enctype="multipart/form-data">
    <div class="container">
        <label><b>Username</b></label>
        <input type="text" placeholder="Enter Username" name="username" required>

        <button type="submit">Login</button>
    </div>
</form>

After click the login button, the page shows :
schema: invalid path "username"schema: invalid path "username"

Desktop (please complete the following information):

  • OS: debian

iris.Version

  • v12.2.11

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions