-
Notifications
You must be signed in to change notification settings - Fork 8k
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
support bind http header param #1956 #1957
Merged
thinkerou
merged 8 commits into
gin-gonic:master
from
guonaihong:1956-feature-support-bind-http-header
Jun 27, 2019
Merged
support bind http header param #1956 #1957
thinkerou
merged 8 commits into
gin-gonic:master
from
guonaihong:1956-feature-support-bind-http-header
Jun 27, 2019
Commits on Jun 18, 2019
-
support bind http header param gin-gonic#1956
update gin-gonic#1956 ``` package main import ( "fmt" "github.com/gin-gonic/gin" ) type testHeader struct { Rate int `header:"Rate"` Domain string `header:"Domain"` } func main() { r := gin.Default() r.GET("/", func(c *gin.Context) { h := testHeader{} if err := c.ShouldBindHeader(&h); err != nil { c.JSON(200, err) } fmt.Printf("%#v\n", h) c.JSON(200, gin.H{"Rate": h.Rate, "Domain": h.Domain}) }) r.Run() // client // curl -H "rate:300" -H "domain:music" 127.0.0.1:8080/ // output // {"Domain":"music","Rate":300} } ```
Configuration menu - View commit details
-
Copy full SHA for 027f846 - Browse repository at this point
Copy the full SHA 027f846View commit details
Commits on Jun 20, 2019
-
Configuration menu - View commit details
-
Copy full SHA for f439a1b - Browse repository at this point
Copy the full SHA f439a1bView commit details
Commits on Jun 23, 2019
-
Modify the code to get the http header
When the http header is obtained in the standard library, the key value will be modified by the CanonicalMIMEHeaderKey function, and finally the value of the http header will be obtained from the map. As follows. ```go func (h MIMEHeader) Get(key string) string { // ... v := h[CanonicalMIMEHeaderKey(key)] // ... } ``` This pr also follows this modification
Configuration menu - View commit details
-
Copy full SHA for ce723d2 - Browse repository at this point
Copy the full SHA ce723d2View commit details
Commits on Jun 24, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 159224b - Browse repository at this point
Copy the full SHA 159224bView commit details
Commits on Jun 25, 2019
-
env GOPATH=`pwd` go test github.com/gin-gonic/gin/binding -coverprofile=cover.prof ok github.com/gin-gonic/gin/binding 0.015s coverage: 100.0% of statements
Configuration menu - View commit details
-
Copy full SHA for c438fc1 - Browse repository at this point
Copy the full SHA c438fc1View commit details
Commits on Jun 26, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 8a7e38a - Browse repository at this point
Copy the full SHA 8a7e38aView commit details -
Configuration menu - View commit details
-
Copy full SHA for f9f0f9d - Browse repository at this point
Copy the full SHA f9f0f9dView commit details
Commits on Jun 27, 2019
-
Configuration menu - View commit details
-
Copy full SHA for adef0a8 - Browse repository at this point
Copy the full SHA adef0a8View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.