Skip to content

net/ghttp: Param in header would affect the following params parse #4227

Open
@UncleChair

Description

@UncleChair

Go version

go version go1.23.2 windows/amd64

GoFrame version

2.9.0

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

Initial web project with the latest version and modify the HelloReq to :

type HelloReq struct {
  g.Meta  `path:"/hello" tags:"Project" method:"get" sum:"List all projects"`
  Token   string `json:"Authorization" des:"JWT" in:"header"`
  Owned   bool   `json:"owned" in:"query" default:"false"`
  Deleted bool   `json:"deleted" in:"query" default:"false"`
}

Send the request and dump req in controller

curl --location 'http://localhost:8000/hello?deleted=false' \
--header 'Authorization: 1'

What did you see happen?

The dump info would show:

{
    Token:   "1",
    Owned:   true,
    Deleted: false,
}

What did you expect to see?

In the previous version (2.8.3), it was:

{
    Token:   "1",
    Owned:   false,
    Deleted: false,
}

Or if you move the Token to the end of the structure, it would also have the right dump:

{
    Owned:   false,
    Deleted: false,
    Token:   "1",
}

Seems some changes was made with the param parse? Haven't locate the bug yet, may be gconv related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIt is confirmed a bug, but don't worry, we'll handle it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions