Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

False positive with ShouldBindQuery using gin framework #18

Open
yiannisccmath opened this issue Aug 22, 2022 · 0 comments
Open

False positive with ShouldBindQuery using gin framework #18

yiannisccmath opened this issue Aug 22, 2022 · 0 comments

Comments

@yiannisccmath
Copy link

yiannisccmath commented Aug 22, 2022

type queryGetParams struct {
	ID          *uint64 `form:"id"`
	Pagination  *uint64 `form:"pagination"`
}

func getUsers(ctx *gin.Context) {
	params := queryGetParams{}
	if err := ctx.ShouldBindQuery(&params); err != nil {
		ctx.AbortWithStatusJSON(http.StatusBadRequest, "invalid query params")
		return
	}
}

above fails with
execinquery It's better to use Execute method instead of ShouldBindQuery method to execute `` query

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant