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

resolve #368 add option to UseNumber() in gin.Context.BindJSON() #997

Merged

Conversation

whirosan
Copy link
Contributor

@whirosan whirosan commented Jul 9, 2017

resolve #368
I added an option EnableJsonDecoderUseNumber, so that you can choose whether or not to enable UseNumber in the JSON decoder.
Please review.

@codecov
Copy link

codecov bot commented Jul 9, 2017

Codecov Report

Merging #997 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #997      +/-   ##
==========================================
+ Coverage   96.52%   96.53%   +<.01%     
==========================================
  Files          16       16              
  Lines        1412     1414       +2     
==========================================
+ Hits         1363     1365       +2     
  Misses         39       39              
  Partials       10       10
Impacted Files Coverage Δ
mode.go 82.6% <100%> (+1.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6256db...7dfaa6a. Read the comment docs.

@javierprovecho javierprovecho merged commit fb7448f into gin-gonic:master Jul 10, 2017
@javierprovecho javierprovecho added this to the 1.3 milestone Jul 10, 2017
@thinkerou
Copy link
Member

thinkerou commented Sep 8, 2017

Sorry I don't understand the pr to solve what?

If I have the follow code:

type Login struct {
    User     string `form:"user" json:"user" binding:"required"`
    Password int    `form:"password" json:"password" binding:"required"`
}

......

var j Login
err := c.BindJSON(&j)

If I don't use gin.EnableJsonDecoderUseNumber(), it is also OK.

tonyhhyip pushed a commit to ysitd-cloud/gin that referenced this pull request Feb 20, 2018
…) close gin-gonic#368

* resolve gin-gonic#368 add option to UseNumber() in gin.Context.BindJSON()

* add test
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

Successfully merging this pull request may close these issues.

add option to UseNumber() in gin.Context.BindJSON()
4 participants