mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-20 00:02:16 +08:00
Merge branch 'master' into fix-linter-warnings
This commit is contained in:
commit
5b32b4a310
46
.github/ISSUE_TEMPLATE.md
vendored
46
.github/ISSUE_TEMPLATE.md
vendored
@ -3,11 +3,47 @@
|
|||||||
- Please provide source code and commit sha if you found a bug.
|
- Please provide source code and commit sha if you found a bug.
|
||||||
- Review existing issues and provide feedback or react to them.
|
- Review existing issues and provide feedback or react to them.
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- Description of a problem -->
|
||||||
|
|
||||||
|
## How to reproduce
|
||||||
|
|
||||||
|
<!-- The smallest possible code example to show the problem that can be compiled, like -->
|
||||||
|
```
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
g := gin.Default()
|
||||||
|
g.GET("/hello/:name", func(c *gin.Context) {
|
||||||
|
c.String(200, "Hello %s", c.Param("name"))
|
||||||
|
})
|
||||||
|
g.Run(":9000")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Expectations
|
||||||
|
|
||||||
|
<!-- Your expectation result of 'curl' command, like -->
|
||||||
|
```
|
||||||
|
$ curl http://localhost:8201/hello/world
|
||||||
|
Hello world
|
||||||
|
```
|
||||||
|
|
||||||
|
## Actual result
|
||||||
|
|
||||||
|
<!-- Actual result showing the problem -->
|
||||||
|
```
|
||||||
|
$ curl -i http://localhost:8201/hello/world
|
||||||
|
<YOUR RESULT>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
|
||||||
- go version:
|
- go version:
|
||||||
- gin version (or commit ref):
|
- gin version (or commit ref):
|
||||||
- operating system:
|
- operating system:
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
|
@ -145,12 +145,12 @@ func main() {
|
|||||||
"message": "pong",
|
"message": "pong",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
r.Run() // listen and serve on 0.0.0.0:8080
|
r.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
```
|
||||||
# run example.go and visit 0.0.0.0:8080/ping on browser
|
# run example.go and visit 0.0.0.0:8080/ping (for windows "localhost:8080/ping") on browser
|
||||||
$ go run example.go
|
$ go run example.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/gin-gonic/gin/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errUnknownType = errors.New("Unknown type")
|
var errUnknownType = errors.New("unknown type")
|
||||||
|
|
||||||
func mapUri(ptr interface{}, m map[string][]string) error {
|
func mapUri(ptr interface{}, m map[string][]string) error {
|
||||||
return mapFormByTag(ptr, m, "uri")
|
return mapFormByTag(ptr, m, "uri")
|
||||||
|
@ -744,7 +744,7 @@ func bodyAllowedForStatus(status int) bool {
|
|||||||
|
|
||||||
// Status sets the HTTP response code.
|
// Status sets the HTTP response code.
|
||||||
func (c *Context) Status(code int) {
|
func (c *Context) Status(code int) {
|
||||||
c.writermem.WriteHeader(code)
|
c.Writer.WriteHeader(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header is a intelligent shortcut for c.Writer.Header().Set(key, value).
|
// Header is a intelligent shortcut for c.Writer.Header().Set(key, value).
|
||||||
|
1
go.sum
1
go.sum
@ -1,4 +1,5 @@
|
|||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user