-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
FormPost will binding failed of custom type in some case with json.Unmarshal #2510
Labels
Comments
If you only want to custom the datetime format, here is a tag already exist in Gin: Lines 280 to 329 in 65ed60e
|
indust
added a commit
to indust/gin
that referenced
this issue
Sep 6, 2021
I will take it. |
Hi @LaysDragon is this issue still persist? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
While the implement of
binding.FormPost
will trying to usejson.Unmarshal
to deal with custom or unknown type.gin/binding/form_mapping.go
Line 212 in 3100b7c
But it will failed if the data is represent as string in json, since
application/x-www-form-urlencoded
won't quote string data. These data will not pass the json's validation.And the
json.Unmarshal
for custom data feature is totally broken here. Since we have no way to known if it a string type or other type inapplication/x-www-form-urlencoded
format.I suggest we can add a logic here if it parse custom type failed with json,then add a quote then try again.
How to reproduce
Expectations
Actual result
console output
Environment
The text was updated successfully, but these errors were encountered: