Skip to content

string “NULL” in Query will treated as nil in STD router StructReq #3465

@ihipop

Description

@ihipop

What version of Go and system type/arch are you using?

go version go1.22.0 linux/amd64

What version of GoFrame are you using?

v2.7.0

Can this bug be re-produced with the latest release?
YES

What did you do?

define a STD router REQ

type NULLStringReq struct {
	g.Meta    `path:"/test" method:"get"  summary:"STRING NULL TESTER"`
	ES []string `json:"es"  v:"required" `
}

test with this REQs

  • GET /test?es[]=NULL result in NULLStringReq.ES = []string{"NULL"}
  • GET /test?es=1 result in NULLStringReq.ES = []string{"1"}
  • GET /test?es=NULL result in NULLStringReq.ES = nil

What did you expect to see?

  • GET /test?es=NULL result in NULLStringReq.ES = []string{"NULL"}

just like GET /test?es=1 or like the raw method,which is correct

What did you see instead?

image

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