Skip to content
New issue

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

json tag中包含form会将请求参数转换为form表单而不是application/json格式 #100

Open
fiecato opened this issue Mar 6, 2024 · 1 comment

Comments

@fiecato
Copy link

fiecato commented Mar 6, 2024

如果字段名字中带有form字符,会将json的tag错误识别,导致请求转为form提交

                         // if defineStruct, ok := route.RequestType.(spec.DefineStruct); ok {
			// 	for _, member := range defineStruct.Members {
			// 		if strings.Contains(member.Tag, "form") {
			// 			operationObject.Consumes = []string{"multipart/form-data"}
			// 			break
			// 		}
			// 	}
			// }

目前只能先注释掉该部分内容进行使用

@zzhaolei
Copy link

同遇到此问题,get 请求携带参数的时候,标准库会 parse query 失败,因为 consumes 定义了 multipart/form-data,但是缺少 boundary。

默认不应该是 application/x-www-form-urlencoded 吗

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

No branches or pull requests

2 participants