-
Notifications
You must be signed in to change notification settings - Fork 544
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
0.7.0 BindAndValidate 无法绑定 time.Time #964
Comments
@liuzhaowei55 感谢你的反馈。v0.7.0 做了绑定的重构,time.Time 我们将其做出了一个默认的自定义类型绑定,导致之前 json.unmarshal() 的值被覆盖掉。我来修复下 |
@liuzhaowei55 目前可以直接使用 c.BindJSON() 来规避下 |
另外就是 v0.6.8 可以通过定义 |
可以的,这块是对 time.Time 做了特殊处理,导致出现 diff,马上修复。先用用 c.BindJSON() |
@liuzhaowei55 已经修复,#965
之前绑定的行为是 "只有 tag 匹配才执行自定义的行为",重构后我们想要做的是 "所有的自定义的行为都一定会执行",所以默认的 time.Time 被执行了。(在上述修复中,我们将这种行为改回来了,下个小版本发布) 这块我建议你直接使用 c.BindJSON() 接口就好,这样的话可以省去许多其他的绑定逻辑,性能更好。 |
已修复 v0.7.1 |
|
可以给个更具体的 struct 和 curl 吗 |
上面已经给出curl了啊, type MyTime time.Time |
我复现了问题,这块是因为解析字段的时候,没有继续去识别该字段是一个 type 别名类型。和这个 issue 不是同一个问题,可以再提个 issue 吗? 我来修复下 |
Describe the bug
0.7.0 BindAndValidate 无法绑定 time.Time
To Reproduce
request body
struct
bind
结果 StartAt 是空值,0.6.8 正常
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Hertz version:
0.7.0
Environment:
The output of
go env
.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: