mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 22:32:26 +08:00
replacing the imports
This commit is contained in:
parent
844d03ab00
commit
d7bb433fa9
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
@ -14,7 +14,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -30,7 +30,7 @@ install:
|
|||||||
- if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
|
- if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
|
||||||
- if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
|
- if [[ "${GO111MODULE}" = "on" ]]; then make tools; fi
|
||||||
|
|
||||||
go_import_path: github.com/gin-gonic/gin
|
go_import_path: github.com/softwear/gin
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make vet
|
- make vet
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
**Date:** May 04th, 2020
|
**Date:** May 04th, 2020
|
||||||
**Version:** Gin v1.6.3
|
**Version:** Gin v1.6.3
|
||||||
**Go Version:** 1.14.2 linux/amd64
|
**Go Version:** 1.14.2 linux/amd64
|
||||||
**Source:** [Go HTTP Router Benchmark](https://github.com/gin-gonic/go-http-routing-benchmark)
|
**Source:** [Go HTTP Router Benchmark](https://github.com/softwear/go-http-routing-benchmark)
|
||||||
**Result:** [See the gist](https://gist.github.com/appleboy/b5f2ecfaf50824ae9c64dcfb9165ae5e) or [Travis result](https://travis-ci.org/github/gin-gonic/go-http-routing-benchmark/jobs/682947061)
|
**Result:** [See the gist](https://gist.github.com/appleboy/b5f2ecfaf50824ae9c64dcfb9165ae5e) or [Travis result](https://travis-ci.org/github/softwear/go-http-routing-benchmark/jobs/682947061)
|
||||||
|
|
||||||
## Static Routes: 157
|
## Static Routes: 157
|
||||||
|
|
||||||
|
298
CHANGELOG.md
298
CHANGELOG.md
@ -4,183 +4,183 @@
|
|||||||
|
|
||||||
### ENHANCEMENTS
|
### ENHANCEMENTS
|
||||||
|
|
||||||
* Improve performance: Change `*sync.RWMutex` to `sync.RWMutex` in context. [#2351](https://github.com/gin-gonic/gin/pull/2351)
|
* Improve performance: Change `*sync.RWMutex` to `sync.RWMutex` in context. [#2351](https://github.com/softwear/gin/pull/2351)
|
||||||
|
|
||||||
## Gin v1.6.2
|
## Gin v1.6.2
|
||||||
|
|
||||||
### BUGFIXES
|
### BUGFIXES
|
||||||
* fix missing initial sync.RWMutex [#2305](https://github.com/gin-gonic/gin/pull/2305)
|
* fix missing initial sync.RWMutex [#2305](https://github.com/softwear/gin/pull/2305)
|
||||||
### ENHANCEMENTS
|
### ENHANCEMENTS
|
||||||
* Add set samesite in cookie. [#2306](https://github.com/gin-gonic/gin/pull/2306)
|
* Add set samesite in cookie. [#2306](https://github.com/softwear/gin/pull/2306)
|
||||||
|
|
||||||
## Gin v1.6.1
|
## Gin v1.6.1
|
||||||
|
|
||||||
### BUGFIXES
|
### BUGFIXES
|
||||||
* Revert "fix accept incoming network connections" [#2294](https://github.com/gin-gonic/gin/pull/2294)
|
* Revert "fix accept incoming network connections" [#2294](https://github.com/softwear/gin/pull/2294)
|
||||||
|
|
||||||
## Gin v1.6.0
|
## Gin v1.6.0
|
||||||
|
|
||||||
### BREAKING
|
### BREAKING
|
||||||
* chore(performance): Improve performance for adding RemoveExtraSlash flag [#2159](https://github.com/gin-gonic/gin/pull/2159)
|
* chore(performance): Improve performance for adding RemoveExtraSlash flag [#2159](https://github.com/softwear/gin/pull/2159)
|
||||||
* drop support govendor [#2148](https://github.com/gin-gonic/gin/pull/2148)
|
* drop support govendor [#2148](https://github.com/softwear/gin/pull/2148)
|
||||||
* Added support for SameSite cookie flag [#1615](https://github.com/gin-gonic/gin/pull/1615)
|
* Added support for SameSite cookie flag [#1615](https://github.com/softwear/gin/pull/1615)
|
||||||
### FEATURES
|
### FEATURES
|
||||||
* add yaml negotiation [#2220](https://github.com/gin-gonic/gin/pull/2220)
|
* add yaml negotiation [#2220](https://github.com/softwear/gin/pull/2220)
|
||||||
* FileFromFS [#2112](https://github.com/gin-gonic/gin/pull/2112)
|
* FileFromFS [#2112](https://github.com/softwear/gin/pull/2112)
|
||||||
### BUGFIXES
|
### BUGFIXES
|
||||||
* Unix Socket Handling [#2280](https://github.com/gin-gonic/gin/pull/2280)
|
* Unix Socket Handling [#2280](https://github.com/softwear/gin/pull/2280)
|
||||||
* Use json marshall in context json to fix breaking new line issue. Fixes #2209 [#2228](https://github.com/gin-gonic/gin/pull/2228)
|
* Use json marshall in context json to fix breaking new line issue. Fixes #2209 [#2228](https://github.com/softwear/gin/pull/2228)
|
||||||
* fix accept incoming network connections [#2216](https://github.com/gin-gonic/gin/pull/2216)
|
* fix accept incoming network connections [#2216](https://github.com/softwear/gin/pull/2216)
|
||||||
* Fixed a bug in the calculation of the maximum number of parameters [#2166](https://github.com/gin-gonic/gin/pull/2166)
|
* Fixed a bug in the calculation of the maximum number of parameters [#2166](https://github.com/softwear/gin/pull/2166)
|
||||||
* [FIX] allow empty headers on DataFromReader [#2121](https://github.com/gin-gonic/gin/pull/2121)
|
* [FIX] allow empty headers on DataFromReader [#2121](https://github.com/softwear/gin/pull/2121)
|
||||||
* Add mutex for protect Context.Keys map [#1391](https://github.com/gin-gonic/gin/pull/1391)
|
* Add mutex for protect Context.Keys map [#1391](https://github.com/softwear/gin/pull/1391)
|
||||||
### ENHANCEMENTS
|
### ENHANCEMENTS
|
||||||
* Add mitigation for log injection [#2277](https://github.com/gin-gonic/gin/pull/2277)
|
* Add mitigation for log injection [#2277](https://github.com/softwear/gin/pull/2277)
|
||||||
* tree: range over nodes values [#2229](https://github.com/gin-gonic/gin/pull/2229)
|
* tree: range over nodes values [#2229](https://github.com/softwear/gin/pull/2229)
|
||||||
* tree: remove duplicate assignment [#2222](https://github.com/gin-gonic/gin/pull/2222)
|
* tree: remove duplicate assignment [#2222](https://github.com/softwear/gin/pull/2222)
|
||||||
* chore: upgrade go-isatty and json-iterator/go [#2215](https://github.com/gin-gonic/gin/pull/2215)
|
* chore: upgrade go-isatty and json-iterator/go [#2215](https://github.com/softwear/gin/pull/2215)
|
||||||
* path: sync code with httprouter [#2212](https://github.com/gin-gonic/gin/pull/2212)
|
* path: sync code with httprouter [#2212](https://github.com/softwear/gin/pull/2212)
|
||||||
* Use zero-copy approach to convert types between string and byte slice [#2206](https://github.com/gin-gonic/gin/pull/2206)
|
* Use zero-copy approach to convert types between string and byte slice [#2206](https://github.com/softwear/gin/pull/2206)
|
||||||
* Reuse bytes when cleaning the URL paths [#2179](https://github.com/gin-gonic/gin/pull/2179)
|
* Reuse bytes when cleaning the URL paths [#2179](https://github.com/softwear/gin/pull/2179)
|
||||||
* tree: remove one else statement [#2177](https://github.com/gin-gonic/gin/pull/2177)
|
* tree: remove one else statement [#2177](https://github.com/softwear/gin/pull/2177)
|
||||||
* tree: sync httprouter update (#2173) (#2172) [#2171](https://github.com/gin-gonic/gin/pull/2171)
|
* tree: sync httprouter update (#2173) (#2172) [#2171](https://github.com/softwear/gin/pull/2171)
|
||||||
* tree: sync part httprouter codes and reduce if/else [#2163](https://github.com/gin-gonic/gin/pull/2163)
|
* tree: sync part httprouter codes and reduce if/else [#2163](https://github.com/softwear/gin/pull/2163)
|
||||||
* use http method constant [#2155](https://github.com/gin-gonic/gin/pull/2155)
|
* use http method constant [#2155](https://github.com/softwear/gin/pull/2155)
|
||||||
* upgrade go-validator to v10 [#2149](https://github.com/gin-gonic/gin/pull/2149)
|
* upgrade go-validator to v10 [#2149](https://github.com/softwear/gin/pull/2149)
|
||||||
* Refactor redirect request in gin.go [#1970](https://github.com/gin-gonic/gin/pull/1970)
|
* Refactor redirect request in gin.go [#1970](https://github.com/softwear/gin/pull/1970)
|
||||||
* Add build tag nomsgpack [#1852](https://github.com/gin-gonic/gin/pull/1852)
|
* Add build tag nomsgpack [#1852](https://github.com/softwear/gin/pull/1852)
|
||||||
### DOCS
|
### DOCS
|
||||||
* docs(path): improve comments [#2223](https://github.com/gin-gonic/gin/pull/2223)
|
* docs(path): improve comments [#2223](https://github.com/softwear/gin/pull/2223)
|
||||||
* Renew README to fit the modification of SetCookie method [#2217](https://github.com/gin-gonic/gin/pull/2217)
|
* Renew README to fit the modification of SetCookie method [#2217](https://github.com/softwear/gin/pull/2217)
|
||||||
* Fix spelling [#2202](https://github.com/gin-gonic/gin/pull/2202)
|
* Fix spelling [#2202](https://github.com/softwear/gin/pull/2202)
|
||||||
* Remove broken link from README. [#2198](https://github.com/gin-gonic/gin/pull/2198)
|
* Remove broken link from README. [#2198](https://github.com/softwear/gin/pull/2198)
|
||||||
* Update docs on Context.Done(), Context.Deadline() and Context.Err() [#2196](https://github.com/gin-gonic/gin/pull/2196)
|
* Update docs on Context.Done(), Context.Deadline() and Context.Err() [#2196](https://github.com/softwear/gin/pull/2196)
|
||||||
* Update validator to v10 [#2190](https://github.com/gin-gonic/gin/pull/2190)
|
* Update validator to v10 [#2190](https://github.com/softwear/gin/pull/2190)
|
||||||
* upgrade go-validator to v10 for README [#2189](https://github.com/gin-gonic/gin/pull/2189)
|
* upgrade go-validator to v10 for README [#2189](https://github.com/softwear/gin/pull/2189)
|
||||||
* Update to currently output [#2188](https://github.com/gin-gonic/gin/pull/2188)
|
* Update to currently output [#2188](https://github.com/softwear/gin/pull/2188)
|
||||||
* Fix "Custom Validators" example [#2186](https://github.com/gin-gonic/gin/pull/2186)
|
* Fix "Custom Validators" example [#2186](https://github.com/softwear/gin/pull/2186)
|
||||||
* Add project to README [#2165](https://github.com/gin-gonic/gin/pull/2165)
|
* Add project to README [#2165](https://github.com/softwear/gin/pull/2165)
|
||||||
* docs(benchmarks): for gin v1.5 [#2153](https://github.com/gin-gonic/gin/pull/2153)
|
* docs(benchmarks): for gin v1.5 [#2153](https://github.com/softwear/gin/pull/2153)
|
||||||
* Changed wording for clarity in README.md [#2122](https://github.com/gin-gonic/gin/pull/2122)
|
* Changed wording for clarity in README.md [#2122](https://github.com/softwear/gin/pull/2122)
|
||||||
### MISC
|
### MISC
|
||||||
* ci support go1.14 [#2262](https://github.com/gin-gonic/gin/pull/2262)
|
* ci support go1.14 [#2262](https://github.com/softwear/gin/pull/2262)
|
||||||
* chore: upgrade depend version [#2231](https://github.com/gin-gonic/gin/pull/2231)
|
* chore: upgrade depend version [#2231](https://github.com/softwear/gin/pull/2231)
|
||||||
* Drop support go1.10 [#2147](https://github.com/gin-gonic/gin/pull/2147)
|
* Drop support go1.10 [#2147](https://github.com/softwear/gin/pull/2147)
|
||||||
* fix comment in `mode.go` [#2129](https://github.com/gin-gonic/gin/pull/2129)
|
* fix comment in `mode.go` [#2129](https://github.com/softwear/gin/pull/2129)
|
||||||
|
|
||||||
## Gin v1.5.0
|
## Gin v1.5.0
|
||||||
|
|
||||||
- [FIX] Use DefaultWriter and DefaultErrorWriter for debug messages [#1891](https://github.com/gin-gonic/gin/pull/1891)
|
- [FIX] Use DefaultWriter and DefaultErrorWriter for debug messages [#1891](https://github.com/softwear/gin/pull/1891)
|
||||||
- [NEW] Now you can parse the inline lowercase start structure [#1893](https://github.com/gin-gonic/gin/pull/1893)
|
- [NEW] Now you can parse the inline lowercase start structure [#1893](https://github.com/softwear/gin/pull/1893)
|
||||||
- [FIX] Some code improvements [#1909](https://github.com/gin-gonic/gin/pull/1909)
|
- [FIX] Some code improvements [#1909](https://github.com/softwear/gin/pull/1909)
|
||||||
- [FIX] Use encode replace json marshal increase json encoder speed [#1546](https://github.com/gin-gonic/gin/pull/1546)
|
- [FIX] Use encode replace json marshal increase json encoder speed [#1546](https://github.com/softwear/gin/pull/1546)
|
||||||
- [NEW] Hold matched route full path in the Context [#1826](https://github.com/gin-gonic/gin/pull/1826)
|
- [NEW] Hold matched route full path in the Context [#1826](https://github.com/softwear/gin/pull/1826)
|
||||||
- [FIX] Fix context.Params race condition on Copy() [#1841](https://github.com/gin-gonic/gin/pull/1841)
|
- [FIX] Fix context.Params race condition on Copy() [#1841](https://github.com/softwear/gin/pull/1841)
|
||||||
- [NEW] Add context param query cache [#1450](https://github.com/gin-gonic/gin/pull/1450)
|
- [NEW] Add context param query cache [#1450](https://github.com/softwear/gin/pull/1450)
|
||||||
- [FIX] Improve GetQueryMap performance [#1918](https://github.com/gin-gonic/gin/pull/1918)
|
- [FIX] Improve GetQueryMap performance [#1918](https://github.com/softwear/gin/pull/1918)
|
||||||
- [FIX] Improve get post data [#1920](https://github.com/gin-gonic/gin/pull/1920)
|
- [FIX] Improve get post data [#1920](https://github.com/softwear/gin/pull/1920)
|
||||||
- [FIX] Use context instead of x/net/context [#1922](https://github.com/gin-gonic/gin/pull/1922)
|
- [FIX] Use context instead of x/net/context [#1922](https://github.com/softwear/gin/pull/1922)
|
||||||
- [FIX] Attempt to fix PostForm cache bug [#1931](https://github.com/gin-gonic/gin/pull/1931)
|
- [FIX] Attempt to fix PostForm cache bug [#1931](https://github.com/softwear/gin/pull/1931)
|
||||||
- [NEW] Add support of multipart multi files [#1949](https://github.com/gin-gonic/gin/pull/1949)
|
- [NEW] Add support of multipart multi files [#1949](https://github.com/softwear/gin/pull/1949)
|
||||||
- [NEW] Support bind http header param [#1957](https://github.com/gin-gonic/gin/pull/1957)
|
- [NEW] Support bind http header param [#1957](https://github.com/softwear/gin/pull/1957)
|
||||||
- [FIX] Drop support for go1.8 and go1.9 [#1933](https://github.com/gin-gonic/gin/pull/1933)
|
- [FIX] Drop support for go1.8 and go1.9 [#1933](https://github.com/softwear/gin/pull/1933)
|
||||||
- [FIX] Bugfix for the FullPath feature [#1919](https://github.com/gin-gonic/gin/pull/1919)
|
- [FIX] Bugfix for the FullPath feature [#1919](https://github.com/softwear/gin/pull/1919)
|
||||||
- [FIX] Gin1.5 bytes.Buffer to strings.Builder [#1939](https://github.com/gin-gonic/gin/pull/1939)
|
- [FIX] Gin1.5 bytes.Buffer to strings.Builder [#1939](https://github.com/softwear/gin/pull/1939)
|
||||||
- [FIX] Upgrade github.com/ugorji/go/codec [#1969](https://github.com/gin-gonic/gin/pull/1969)
|
- [FIX] Upgrade github.com/ugorji/go/codec [#1969](https://github.com/softwear/gin/pull/1969)
|
||||||
- [NEW] Support bind unix time [#1980](https://github.com/gin-gonic/gin/pull/1980)
|
- [NEW] Support bind unix time [#1980](https://github.com/softwear/gin/pull/1980)
|
||||||
- [FIX] Simplify code [#2004](https://github.com/gin-gonic/gin/pull/2004)
|
- [FIX] Simplify code [#2004](https://github.com/softwear/gin/pull/2004)
|
||||||
- [NEW] Support negative Content-Length in DataFromReader [#1981](https://github.com/gin-gonic/gin/pull/1981)
|
- [NEW] Support negative Content-Length in DataFromReader [#1981](https://github.com/softwear/gin/pull/1981)
|
||||||
- [FIX] Identify terminal on a RISC-V architecture for auto-colored logs [#2019](https://github.com/gin-gonic/gin/pull/2019)
|
- [FIX] Identify terminal on a RISC-V architecture for auto-colored logs [#2019](https://github.com/softwear/gin/pull/2019)
|
||||||
- [BREAKING] `Context.JSONP()` now expects a semicolon (`;`) at the end [#2007](https://github.com/gin-gonic/gin/pull/2007)
|
- [BREAKING] `Context.JSONP()` now expects a semicolon (`;`) at the end [#2007](https://github.com/softwear/gin/pull/2007)
|
||||||
- [BREAKING] Upgrade default `binding.Validator` to v9 (see [its changelog](https://github.com/go-playground/validator/releases/tag/v9.0.0)) [#1015](https://github.com/gin-gonic/gin/pull/1015)
|
- [BREAKING] Upgrade default `binding.Validator` to v9 (see [its changelog](https://github.com/go-playground/validator/releases/tag/v9.0.0)) [#1015](https://github.com/softwear/gin/pull/1015)
|
||||||
- [NEW] Add `DisallowUnknownFields()` in `Context.BindJSON()` [#2028](https://github.com/gin-gonic/gin/pull/2028)
|
- [NEW] Add `DisallowUnknownFields()` in `Context.BindJSON()` [#2028](https://github.com/softwear/gin/pull/2028)
|
||||||
- [NEW] Use specific `net.Listener` with `Engine.RunListener()` [#2023](https://github.com/gin-gonic/gin/pull/2023)
|
- [NEW] Use specific `net.Listener` with `Engine.RunListener()` [#2023](https://github.com/softwear/gin/pull/2023)
|
||||||
- [FIX] Fix some typo [#2079](https://github.com/gin-gonic/gin/pull/2079) [#2080](https://github.com/gin-gonic/gin/pull/2080)
|
- [FIX] Fix some typo [#2079](https://github.com/softwear/gin/pull/2079) [#2080](https://github.com/softwear/gin/pull/2080)
|
||||||
- [FIX] Relocate binding body tests [#2086](https://github.com/gin-gonic/gin/pull/2086)
|
- [FIX] Relocate binding body tests [#2086](https://github.com/softwear/gin/pull/2086)
|
||||||
- [FIX] Use Writer in Context.Status [#1606](https://github.com/gin-gonic/gin/pull/1606)
|
- [FIX] Use Writer in Context.Status [#1606](https://github.com/softwear/gin/pull/1606)
|
||||||
- [FIX] `Engine.RunUnix()` now returns the error if it can't change the file mode [#2093](https://github.com/gin-gonic/gin/pull/2093)
|
- [FIX] `Engine.RunUnix()` now returns the error if it can't change the file mode [#2093](https://github.com/softwear/gin/pull/2093)
|
||||||
- [FIX] `RouterGroup.StaticFS()` leaked files. Now it closes them. [#2118](https://github.com/gin-gonic/gin/pull/2118)
|
- [FIX] `RouterGroup.StaticFS()` leaked files. Now it closes them. [#2118](https://github.com/softwear/gin/pull/2118)
|
||||||
- [FIX] `Context.Request.FormFile` leaked file. Now it closes it. [#2114](https://github.com/gin-gonic/gin/pull/2114)
|
- [FIX] `Context.Request.FormFile` leaked file. Now it closes it. [#2114](https://github.com/softwear/gin/pull/2114)
|
||||||
- [FIX] Ignore walking on `form:"-"` mapping [#1943](https://github.com/gin-gonic/gin/pull/1943)
|
- [FIX] Ignore walking on `form:"-"` mapping [#1943](https://github.com/softwear/gin/pull/1943)
|
||||||
|
|
||||||
### Gin v1.4.0
|
### Gin v1.4.0
|
||||||
|
|
||||||
- [NEW] Support for [Go Modules](https://github.com/golang/go/wiki/Modules) [#1569](https://github.com/gin-gonic/gin/pull/1569)
|
- [NEW] Support for [Go Modules](https://github.com/golang/go/wiki/Modules) [#1569](https://github.com/softwear/gin/pull/1569)
|
||||||
- [NEW] Refactor of form mapping multipart request [#1829](https://github.com/gin-gonic/gin/pull/1829)
|
- [NEW] Refactor of form mapping multipart request [#1829](https://github.com/softwear/gin/pull/1829)
|
||||||
- [FIX] Truncate Latency precision in long running request [#1830](https://github.com/gin-gonic/gin/pull/1830)
|
- [FIX] Truncate Latency precision in long running request [#1830](https://github.com/softwear/gin/pull/1830)
|
||||||
- [FIX] IsTerm flag should not be affected by DisableConsoleColor method. [#1802](https://github.com/gin-gonic/gin/pull/1802)
|
- [FIX] IsTerm flag should not be affected by DisableConsoleColor method. [#1802](https://github.com/softwear/gin/pull/1802)
|
||||||
- [NEW] Supporting file binding [#1264](https://github.com/gin-gonic/gin/pull/1264)
|
- [NEW] Supporting file binding [#1264](https://github.com/softwear/gin/pull/1264)
|
||||||
- [NEW] Add support for mapping arrays [#1797](https://github.com/gin-gonic/gin/pull/1797)
|
- [NEW] Add support for mapping arrays [#1797](https://github.com/softwear/gin/pull/1797)
|
||||||
- [FIX] Readme updates [#1793](https://github.com/gin-gonic/gin/pull/1793) [#1788](https://github.com/gin-gonic/gin/pull/1788) [1789](https://github.com/gin-gonic/gin/pull/1789)
|
- [FIX] Readme updates [#1793](https://github.com/softwear/gin/pull/1793) [#1788](https://github.com/softwear/gin/pull/1788) [1789](https://github.com/softwear/gin/pull/1789)
|
||||||
- [FIX] StaticFS: Fixed Logging two log lines on 404. [#1805](https://github.com/gin-gonic/gin/pull/1805), [#1804](https://github.com/gin-gonic/gin/pull/1804)
|
- [FIX] StaticFS: Fixed Logging two log lines on 404. [#1805](https://github.com/softwear/gin/pull/1805), [#1804](https://github.com/softwear/gin/pull/1804)
|
||||||
- [NEW] Make context.Keys available as LogFormatterParams [#1779](https://github.com/gin-gonic/gin/pull/1779)
|
- [NEW] Make context.Keys available as LogFormatterParams [#1779](https://github.com/softwear/gin/pull/1779)
|
||||||
- [NEW] Use internal/json for Marshal/Unmarshal [#1791](https://github.com/gin-gonic/gin/pull/1791)
|
- [NEW] Use internal/json for Marshal/Unmarshal [#1791](https://github.com/softwear/gin/pull/1791)
|
||||||
- [NEW] Support mapping time.Duration [#1794](https://github.com/gin-gonic/gin/pull/1794)
|
- [NEW] Support mapping time.Duration [#1794](https://github.com/softwear/gin/pull/1794)
|
||||||
- [NEW] Refactor form mappings [#1749](https://github.com/gin-gonic/gin/pull/1749)
|
- [NEW] Refactor form mappings [#1749](https://github.com/softwear/gin/pull/1749)
|
||||||
- [NEW] Added flag to context.Stream indicates if client disconnected in middle of stream [#1252](https://github.com/gin-gonic/gin/pull/1252)
|
- [NEW] Added flag to context.Stream indicates if client disconnected in middle of stream [#1252](https://github.com/softwear/gin/pull/1252)
|
||||||
- [FIX] Moved [examples](https://github.com/gin-gonic/examples) to stand alone Repo [#1775](https://github.com/gin-gonic/gin/pull/1775)
|
- [FIX] Moved [examples](https://github.com/softwear/examples) to stand alone Repo [#1775](https://github.com/softwear/gin/pull/1775)
|
||||||
- [NEW] Extend context.File to allow for the content-disposition attachments via a new method context.Attachment [#1260](https://github.com/gin-gonic/gin/pull/1260)
|
- [NEW] Extend context.File to allow for the content-disposition attachments via a new method context.Attachment [#1260](https://github.com/softwear/gin/pull/1260)
|
||||||
- [FIX] Support HTTP content negotiation wildcards [#1112](https://github.com/gin-gonic/gin/pull/1112)
|
- [FIX] Support HTTP content negotiation wildcards [#1112](https://github.com/softwear/gin/pull/1112)
|
||||||
- [NEW] Add prefix from X-Forwarded-Prefix in redirectTrailingSlash [#1238](https://github.com/gin-gonic/gin/pull/1238)
|
- [NEW] Add prefix from X-Forwarded-Prefix in redirectTrailingSlash [#1238](https://github.com/softwear/gin/pull/1238)
|
||||||
- [FIX] context.Copy() race condition [#1020](https://github.com/gin-gonic/gin/pull/1020)
|
- [FIX] context.Copy() race condition [#1020](https://github.com/softwear/gin/pull/1020)
|
||||||
- [NEW] Add context.HandlerNames() [#1729](https://github.com/gin-gonic/gin/pull/1729)
|
- [NEW] Add context.HandlerNames() [#1729](https://github.com/softwear/gin/pull/1729)
|
||||||
- [FIX] Change color methods to public in the defaultLogger. [#1771](https://github.com/gin-gonic/gin/pull/1771)
|
- [FIX] Change color methods to public in the defaultLogger. [#1771](https://github.com/softwear/gin/pull/1771)
|
||||||
- [FIX] Update writeHeaders method to use http.Header.Set [#1722](https://github.com/gin-gonic/gin/pull/1722)
|
- [FIX] Update writeHeaders method to use http.Header.Set [#1722](https://github.com/softwear/gin/pull/1722)
|
||||||
- [NEW] Add response size to LogFormatterParams [#1752](https://github.com/gin-gonic/gin/pull/1752)
|
- [NEW] Add response size to LogFormatterParams [#1752](https://github.com/softwear/gin/pull/1752)
|
||||||
- [NEW] Allow ignoring field on form mapping [#1733](https://github.com/gin-gonic/gin/pull/1733)
|
- [NEW] Allow ignoring field on form mapping [#1733](https://github.com/softwear/gin/pull/1733)
|
||||||
- [NEW] Add a function to force color in console output. [#1724](https://github.com/gin-gonic/gin/pull/1724)
|
- [NEW] Add a function to force color in console output. [#1724](https://github.com/softwear/gin/pull/1724)
|
||||||
- [FIX] Context.Next() - recheck len of handlers on every iteration. [#1745](https://github.com/gin-gonic/gin/pull/1745)
|
- [FIX] Context.Next() - recheck len of handlers on every iteration. [#1745](https://github.com/softwear/gin/pull/1745)
|
||||||
- [FIX] Fix all errcheck warnings [#1739](https://github.com/gin-gonic/gin/pull/1739) [#1653](https://github.com/gin-gonic/gin/pull/1653)
|
- [FIX] Fix all errcheck warnings [#1739](https://github.com/softwear/gin/pull/1739) [#1653](https://github.com/softwear/gin/pull/1653)
|
||||||
- [NEW] context: inherits context cancellation and deadline from http.Request context for Go>=1.7 [#1690](https://github.com/gin-gonic/gin/pull/1690)
|
- [NEW] context: inherits context cancellation and deadline from http.Request context for Go>=1.7 [#1690](https://github.com/softwear/gin/pull/1690)
|
||||||
- [NEW] Binding for URL Params [#1694](https://github.com/gin-gonic/gin/pull/1694)
|
- [NEW] Binding for URL Params [#1694](https://github.com/softwear/gin/pull/1694)
|
||||||
- [NEW] Add LoggerWithFormatter method [#1677](https://github.com/gin-gonic/gin/pull/1677)
|
- [NEW] Add LoggerWithFormatter method [#1677](https://github.com/softwear/gin/pull/1677)
|
||||||
- [FIX] CI testing updates [#1671](https://github.com/gin-gonic/gin/pull/1671) [#1670](https://github.com/gin-gonic/gin/pull/1670) [#1682](https://github.com/gin-gonic/gin/pull/1682) [#1669](https://github.com/gin-gonic/gin/pull/1669)
|
- [FIX] CI testing updates [#1671](https://github.com/softwear/gin/pull/1671) [#1670](https://github.com/softwear/gin/pull/1670) [#1682](https://github.com/softwear/gin/pull/1682) [#1669](https://github.com/softwear/gin/pull/1669)
|
||||||
- [FIX] StaticFS(): Send 404 when path does not exist [#1663](https://github.com/gin-gonic/gin/pull/1663)
|
- [FIX] StaticFS(): Send 404 when path does not exist [#1663](https://github.com/softwear/gin/pull/1663)
|
||||||
- [FIX] Handle nil body for JSON binding [#1638](https://github.com/gin-gonic/gin/pull/1638)
|
- [FIX] Handle nil body for JSON binding [#1638](https://github.com/softwear/gin/pull/1638)
|
||||||
- [FIX] Support bind uri param [#1612](https://github.com/gin-gonic/gin/pull/1612)
|
- [FIX] Support bind uri param [#1612](https://github.com/softwear/gin/pull/1612)
|
||||||
- [FIX] recovery: fix issue with syscall import on google app engine [#1640](https://github.com/gin-gonic/gin/pull/1640)
|
- [FIX] recovery: fix issue with syscall import on google app engine [#1640](https://github.com/softwear/gin/pull/1640)
|
||||||
- [FIX] Make sure the debug log contains line breaks [#1650](https://github.com/gin-gonic/gin/pull/1650)
|
- [FIX] Make sure the debug log contains line breaks [#1650](https://github.com/softwear/gin/pull/1650)
|
||||||
- [FIX] Panic stack trace being printed during recovery of broken pipe [#1089](https://github.com/gin-gonic/gin/pull/1089) [#1259](https://github.com/gin-gonic/gin/pull/1259)
|
- [FIX] Panic stack trace being printed during recovery of broken pipe [#1089](https://github.com/softwear/gin/pull/1089) [#1259](https://github.com/softwear/gin/pull/1259)
|
||||||
- [NEW] RunFd method to run http.Server through a file descriptor [#1609](https://github.com/gin-gonic/gin/pull/1609)
|
- [NEW] RunFd method to run http.Server through a file descriptor [#1609](https://github.com/softwear/gin/pull/1609)
|
||||||
- [NEW] Yaml binding support [#1618](https://github.com/gin-gonic/gin/pull/1618)
|
- [NEW] Yaml binding support [#1618](https://github.com/softwear/gin/pull/1618)
|
||||||
- [FIX] Pass MaxMultipartMemory when FormFile is called [#1600](https://github.com/gin-gonic/gin/pull/1600)
|
- [FIX] Pass MaxMultipartMemory when FormFile is called [#1600](https://github.com/softwear/gin/pull/1600)
|
||||||
- [FIX] LoadHTML* tests [#1559](https://github.com/gin-gonic/gin/pull/1559)
|
- [FIX] LoadHTML* tests [#1559](https://github.com/softwear/gin/pull/1559)
|
||||||
- [FIX] Removed use of sync.pool from HandleContext [#1565](https://github.com/gin-gonic/gin/pull/1565)
|
- [FIX] Removed use of sync.pool from HandleContext [#1565](https://github.com/softwear/gin/pull/1565)
|
||||||
- [FIX] Format output log to os.Stderr [#1571](https://github.com/gin-gonic/gin/pull/1571)
|
- [FIX] Format output log to os.Stderr [#1571](https://github.com/softwear/gin/pull/1571)
|
||||||
- [FIX] Make logger use a yellow background and a darkgray text for legibility [#1570](https://github.com/gin-gonic/gin/pull/1570)
|
- [FIX] Make logger use a yellow background and a darkgray text for legibility [#1570](https://github.com/softwear/gin/pull/1570)
|
||||||
- [FIX] Remove sensitive request information from panic log. [#1370](https://github.com/gin-gonic/gin/pull/1370)
|
- [FIX] Remove sensitive request information from panic log. [#1370](https://github.com/softwear/gin/pull/1370)
|
||||||
- [FIX] log.Println() does not print timestamp [#829](https://github.com/gin-gonic/gin/pull/829) [#1560](https://github.com/gin-gonic/gin/pull/1560)
|
- [FIX] log.Println() does not print timestamp [#829](https://github.com/softwear/gin/pull/829) [#1560](https://github.com/softwear/gin/pull/1560)
|
||||||
- [NEW] Add PureJSON renderer [#694](https://github.com/gin-gonic/gin/pull/694)
|
- [NEW] Add PureJSON renderer [#694](https://github.com/softwear/gin/pull/694)
|
||||||
- [FIX] Add missing copyright and update if/else [#1497](https://github.com/gin-gonic/gin/pull/1497)
|
- [FIX] Add missing copyright and update if/else [#1497](https://github.com/softwear/gin/pull/1497)
|
||||||
- [FIX] Update msgpack usage [#1498](https://github.com/gin-gonic/gin/pull/1498)
|
- [FIX] Update msgpack usage [#1498](https://github.com/softwear/gin/pull/1498)
|
||||||
- [FIX] Use protobuf on render [#1496](https://github.com/gin-gonic/gin/pull/1496)
|
- [FIX] Use protobuf on render [#1496](https://github.com/softwear/gin/pull/1496)
|
||||||
- [FIX] Add support for Protobuf format response [#1479](https://github.com/gin-gonic/gin/pull/1479)
|
- [FIX] Add support for Protobuf format response [#1479](https://github.com/softwear/gin/pull/1479)
|
||||||
- [NEW] Set default time format in form binding [#1487](https://github.com/gin-gonic/gin/pull/1487)
|
- [NEW] Set default time format in form binding [#1487](https://github.com/softwear/gin/pull/1487)
|
||||||
- [FIX] Add BindXML and ShouldBindXML [#1485](https://github.com/gin-gonic/gin/pull/1485)
|
- [FIX] Add BindXML and ShouldBindXML [#1485](https://github.com/softwear/gin/pull/1485)
|
||||||
- [NEW] Upgrade dependency libraries [#1491](https://github.com/gin-gonic/gin/pull/1491)
|
- [NEW] Upgrade dependency libraries [#1491](https://github.com/softwear/gin/pull/1491)
|
||||||
|
|
||||||
|
|
||||||
## Gin v1.3.0
|
## Gin v1.3.0
|
||||||
|
|
||||||
- [NEW] Add [`func (*Context) QueryMap`](https://godoc.org/github.com/gin-gonic/gin#Context.QueryMap), [`func (*Context) GetQueryMap`](https://godoc.org/github.com/gin-gonic/gin#Context.GetQueryMap), [`func (*Context) PostFormMap`](https://godoc.org/github.com/gin-gonic/gin#Context.PostFormMap) and [`func (*Context) GetPostFormMap`](https://godoc.org/github.com/gin-gonic/gin#Context.GetPostFormMap) to support `type map[string]string` as query string or form parameters, see [#1383](https://github.com/gin-gonic/gin/pull/1383)
|
- [NEW] Add [`func (*Context) QueryMap`](https://godoc.org/github.com/softwear/gin#Context.QueryMap), [`func (*Context) GetQueryMap`](https://godoc.org/github.com/softwear/gin#Context.GetQueryMap), [`func (*Context) PostFormMap`](https://godoc.org/github.com/softwear/gin#Context.PostFormMap) and [`func (*Context) GetPostFormMap`](https://godoc.org/github.com/softwear/gin#Context.GetPostFormMap) to support `type map[string]string` as query string or form parameters, see [#1383](https://github.com/softwear/gin/pull/1383)
|
||||||
- [NEW] Add [`func (*Context) AsciiJSON`](https://godoc.org/github.com/gin-gonic/gin#Context.AsciiJSON), see [#1358](https://github.com/gin-gonic/gin/pull/1358)
|
- [NEW] Add [`func (*Context) AsciiJSON`](https://godoc.org/github.com/softwear/gin#Context.AsciiJSON), see [#1358](https://github.com/softwear/gin/pull/1358)
|
||||||
- [NEW] Add `Pusher()` in [`type ResponseWriter`](https://godoc.org/github.com/gin-gonic/gin#ResponseWriter) for supporting http2 push, see [#1273](https://github.com/gin-gonic/gin/pull/1273)
|
- [NEW] Add `Pusher()` in [`type ResponseWriter`](https://godoc.org/github.com/softwear/gin#ResponseWriter) for supporting http2 push, see [#1273](https://github.com/softwear/gin/pull/1273)
|
||||||
- [NEW] Add [`func (*Context) DataFromReader`](https://godoc.org/github.com/gin-gonic/gin#Context.DataFromReader) for serving dynamic data, see [#1304](https://github.com/gin-gonic/gin/pull/1304)
|
- [NEW] Add [`func (*Context) DataFromReader`](https://godoc.org/github.com/softwear/gin#Context.DataFromReader) for serving dynamic data, see [#1304](https://github.com/softwear/gin/pull/1304)
|
||||||
- [NEW] Add [`func (*Context) ShouldBindBodyWith`](https://godoc.org/github.com/gin-gonic/gin#Context.ShouldBindBodyWith) allowing to call binding multiple times, see [#1341](https://github.com/gin-gonic/gin/pull/1341)
|
- [NEW] Add [`func (*Context) ShouldBindBodyWith`](https://godoc.org/github.com/softwear/gin#Context.ShouldBindBodyWith) allowing to call binding multiple times, see [#1341](https://github.com/softwear/gin/pull/1341)
|
||||||
- [NEW] Support pointers in form binding, see [#1336](https://github.com/gin-gonic/gin/pull/1336)
|
- [NEW] Support pointers in form binding, see [#1336](https://github.com/softwear/gin/pull/1336)
|
||||||
- [NEW] Add [`func (*Context) JSONP`](https://godoc.org/github.com/gin-gonic/gin#Context.JSONP), see [#1333](https://github.com/gin-gonic/gin/pull/1333)
|
- [NEW] Add [`func (*Context) JSONP`](https://godoc.org/github.com/softwear/gin#Context.JSONP), see [#1333](https://github.com/softwear/gin/pull/1333)
|
||||||
- [NEW] Support default value in form binding, see [#1138](https://github.com/gin-gonic/gin/pull/1138)
|
- [NEW] Support default value in form binding, see [#1138](https://github.com/softwear/gin/pull/1138)
|
||||||
- [NEW] Expose validator engine in [`type StructValidator`](https://godoc.org/github.com/gin-gonic/gin/binding#StructValidator), see [#1277](https://github.com/gin-gonic/gin/pull/1277)
|
- [NEW] Expose validator engine in [`type StructValidator`](https://godoc.org/github.com/softwear/gin/binding#StructValidator), see [#1277](https://github.com/softwear/gin/pull/1277)
|
||||||
- [NEW] Add [`func (*Context) ShouldBind`](https://godoc.org/github.com/gin-gonic/gin#Context.ShouldBind), [`func (*Context) ShouldBindQuery`](https://godoc.org/github.com/gin-gonic/gin#Context.ShouldBindQuery) and [`func (*Context) ShouldBindJSON`](https://godoc.org/github.com/gin-gonic/gin#Context.ShouldBindJSON), see [#1047](https://github.com/gin-gonic/gin/pull/1047)
|
- [NEW] Add [`func (*Context) ShouldBind`](https://godoc.org/github.com/softwear/gin#Context.ShouldBind), [`func (*Context) ShouldBindQuery`](https://godoc.org/github.com/softwear/gin#Context.ShouldBindQuery) and [`func (*Context) ShouldBindJSON`](https://godoc.org/github.com/softwear/gin#Context.ShouldBindJSON), see [#1047](https://github.com/softwear/gin/pull/1047)
|
||||||
- [NEW] Add support for `time.Time` location in form binding, see [#1117](https://github.com/gin-gonic/gin/pull/1117)
|
- [NEW] Add support for `time.Time` location in form binding, see [#1117](https://github.com/softwear/gin/pull/1117)
|
||||||
- [NEW] Add [`func (*Context) BindQuery`](https://godoc.org/github.com/gin-gonic/gin#Context.BindQuery), see [#1029](https://github.com/gin-gonic/gin/pull/1029)
|
- [NEW] Add [`func (*Context) BindQuery`](https://godoc.org/github.com/softwear/gin#Context.BindQuery), see [#1029](https://github.com/softwear/gin/pull/1029)
|
||||||
- [NEW] Make [jsonite](https://github.com/json-iterator/go) optional with build tags, see [#1026](https://github.com/gin-gonic/gin/pull/1026)
|
- [NEW] Make [jsonite](https://github.com/json-iterator/go) optional with build tags, see [#1026](https://github.com/softwear/gin/pull/1026)
|
||||||
- [NEW] Show query string in logger, see [#999](https://github.com/gin-gonic/gin/pull/999)
|
- [NEW] Show query string in logger, see [#999](https://github.com/softwear/gin/pull/999)
|
||||||
- [NEW] Add [`func (*Context) SecureJSON`](https://godoc.org/github.com/gin-gonic/gin#Context.SecureJSON), see [#987](https://github.com/gin-gonic/gin/pull/987) and [#993](https://github.com/gin-gonic/gin/pull/993)
|
- [NEW] Add [`func (*Context) SecureJSON`](https://godoc.org/github.com/softwear/gin#Context.SecureJSON), see [#987](https://github.com/softwear/gin/pull/987) and [#993](https://github.com/softwear/gin/pull/993)
|
||||||
- [DEPRECATE] `func (*Context) GetCookie` for [`func (*Context) Cookie`](https://godoc.org/github.com/gin-gonic/gin#Context.Cookie)
|
- [DEPRECATE] `func (*Context) GetCookie` for [`func (*Context) Cookie`](https://godoc.org/github.com/softwear/gin#Context.Cookie)
|
||||||
- [FIX] Don't display color tags if [`func DisableConsoleColor`](https://godoc.org/github.com/gin-gonic/gin#DisableConsoleColor) called, see [#1072](https://github.com/gin-gonic/gin/pull/1072)
|
- [FIX] Don't display color tags if [`func DisableConsoleColor`](https://godoc.org/github.com/softwear/gin#DisableConsoleColor) called, see [#1072](https://github.com/softwear/gin/pull/1072)
|
||||||
- [FIX] Gin Mode `""` when calling [`func Mode`](https://godoc.org/github.com/gin-gonic/gin#Mode) now returns `const DebugMode`, see [#1250](https://github.com/gin-gonic/gin/pull/1250)
|
- [FIX] Gin Mode `""` when calling [`func Mode`](https://godoc.org/github.com/softwear/gin#Mode) now returns `const DebugMode`, see [#1250](https://github.com/softwear/gin/pull/1250)
|
||||||
- [FIX] `Flush()` now doesn't overwrite `responseWriter` status code, see [#1460](https://github.com/gin-gonic/gin/pull/1460)
|
- [FIX] `Flush()` now doesn't overwrite `responseWriter` status code, see [#1460](https://github.com/softwear/gin/pull/1460)
|
||||||
|
|
||||||
## Gin 1.2.0
|
## Gin 1.2.0
|
||||||
|
|
||||||
|
98
README.md
98
README.md
@ -1,16 +1,16 @@
|
|||||||
# Gin Web Framework
|
# Gin Web Framework
|
||||||
|
|
||||||
<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">
|
<img align="right" width="159px" src="https://raw.githubusercontent.com/softwear/logo/master/color.png">
|
||||||
|
|
||||||
[](https://travis-ci.org/gin-gonic/gin)
|
[](https://travis-ci.org/softwear/gin)
|
||||||
[](https://codecov.io/gh/gin-gonic/gin)
|
[](https://codecov.io/gh/softwear/gin)
|
||||||
[](https://goreportcard.com/report/github.com/gin-gonic/gin)
|
[](https://goreportcard.com/report/github.com/softwear/gin)
|
||||||
[](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)
|
[](https://pkg.go.dev/github.com/softwear/gin?tab=doc)
|
||||||
[](https://gitter.im/gin-gonic/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](https://gitter.im/softwear/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
[](https://sourcegraph.com/github.com/gin-gonic/gin?badge)
|
[](https://sourcegraph.com/github.com/softwear/gin?badge)
|
||||||
[](https://www.codetriage.com/gin-gonic/gin)
|
[](https://www.codetriage.com/softwear/gin)
|
||||||
[](https://github.com/gin-gonic/gin/releases)
|
[](https://github.com/softwear/gin/releases)
|
||||||
[](https://www.tickgit.com/browse?repo=github.com/gin-gonic/gin)
|
[](https://www.tickgit.com/browse?repo=github.com/softwear/gin)
|
||||||
|
|
||||||
Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to [httprouter](https://github.com/julienschmidt/httprouter). If you need performance and good productivity, you will love Gin.
|
Gin is a web framework written in Go (Golang). It features a martini-like API with performance that is up to 40 times faster thanks to [httprouter](https://github.com/julienschmidt/httprouter). If you need performance and good productivity, you will love Gin.
|
||||||
|
|
||||||
@ -87,13 +87,13 @@ To install Gin package, you need to install Go and set your Go workspace first.
|
|||||||
1. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin.
|
1. The first need [Go](https://golang.org/) installed (**version 1.12+ is required**), then you can use the below Go command to install Gin.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ go get -u github.com/gin-gonic/gin
|
$ go get -u github.com/softwear/gin
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Import it in your code:
|
2. Import it in your code:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/softwear/gin"
|
||||||
```
|
```
|
||||||
|
|
||||||
3. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.
|
3. (Optional) Import `net/http`. This is required for example if using constants such as `http.StatusOK`.
|
||||||
@ -112,7 +112,7 @@ $ cat example.go
|
|||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/softwear/gin"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
@ -192,7 +192,7 @@ $ go build -tags=jsoniter .
|
|||||||
|
|
||||||
## API Examples
|
## API Examples
|
||||||
|
|
||||||
You can find a number of ready-to-run examples at [Gin examples repository](https://github.com/gin-gonic/examples).
|
You can find a number of ready-to-run examples at [Gin examples repository](https://github.com/softwear/examples).
|
||||||
|
|
||||||
### Using GET, POST, PUT, PATCH, DELETE and OPTIONS
|
### Using GET, POST, PUT, PATCH, DELETE and OPTIONS
|
||||||
|
|
||||||
@ -347,9 +347,9 @@ ids: map[b:hello a:1234]; names: map[second:tianou first:thinkerou]
|
|||||||
|
|
||||||
#### Single file
|
#### Single file
|
||||||
|
|
||||||
References issue [#774](https://github.com/gin-gonic/gin/issues/774) and detail [example code](https://github.com/gin-gonic/examples/tree/master/upload-file/single).
|
References issue [#774](https://github.com/softwear/gin/issues/774) and detail [example code](https://github.com/softwear/examples/tree/master/upload-file/single).
|
||||||
|
|
||||||
`file.Filename` **SHOULD NOT** be trusted. See [`Content-Disposition` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Directives) and [#1693](https://github.com/gin-gonic/gin/issues/1693)
|
`file.Filename` **SHOULD NOT** be trusted. See [`Content-Disposition` on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Directives) and [#1693](https://github.com/softwear/gin/issues/1693)
|
||||||
|
|
||||||
> The filename is always optional and must not be used blindly by the application: path information should be stripped, and conversion to the server file system rules should be done.
|
> The filename is always optional and must not be used blindly by the application: path information should be stripped, and conversion to the server file system rules should be done.
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ curl -X POST http://localhost:8080/upload \
|
|||||||
|
|
||||||
#### Multiple files
|
#### Multiple files
|
||||||
|
|
||||||
See the detail [example code](https://github.com/gin-gonic/examples/tree/master/upload-file/multiple).
|
See the detail [example code](https://github.com/softwear/examples/tree/master/upload-file/multiple).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
@ -747,7 +747,7 @@ When running the above example using the above the `curl` command, it returns er
|
|||||||
|
|
||||||
### Custom Validators
|
### Custom Validators
|
||||||
|
|
||||||
It is also possible to register custom validators. See the [example code](https://github.com/gin-gonic/examples/tree/master/custom-validation/server.go).
|
It is also possible to register custom validators. See the [example code](https://github.com/softwear/examples/tree/master/custom-validation/server.go).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@ -756,8 +756,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
"github.com/go-playground/validator/v10"
|
"github.com/go-playground/validator/v10"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -811,11 +811,11 @@ $ curl "localhost:8085/bookable?check_in=2000-03-09&check_out=2000-03-10"
|
|||||||
```
|
```
|
||||||
|
|
||||||
[Struct level validations](https://github.com/go-playground/validator/releases/tag/v8.7) can also be registered this way.
|
[Struct level validations](https://github.com/go-playground/validator/releases/tag/v8.7) can also be registered this way.
|
||||||
See the [struct-lvl-validation example](https://github.com/gin-gonic/examples/tree/master/struct-lvl-validations) to learn more.
|
See the [struct-lvl-validation example](https://github.com/softwear/examples/tree/master/struct-lvl-validations) to learn more.
|
||||||
|
|
||||||
### Only Bind Query String
|
### Only Bind Query String
|
||||||
|
|
||||||
`ShouldBindQuery` function only binds the query params and not the post data. See the [detail information](https://github.com/gin-gonic/gin/issues/742#issuecomment-315953017).
|
`ShouldBindQuery` function only binds the query params and not the post data. See the [detail information](https://github.com/softwear/gin/issues/742#issuecomment-315953017).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@ -823,7 +823,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Person struct {
|
type Person struct {
|
||||||
@ -851,7 +851,7 @@ func startPage(c *gin.Context) {
|
|||||||
|
|
||||||
### Bind Query String or Post Data
|
### Bind Query String or Post Data
|
||||||
|
|
||||||
See the [detail information](https://github.com/gin-gonic/gin/issues/742#issuecomment-264681292).
|
See the [detail information](https://github.com/softwear/gin/issues/742#issuecomment-264681292).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@ -860,7 +860,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Person struct {
|
type Person struct {
|
||||||
@ -881,7 +881,7 @@ func startPage(c *gin.Context) {
|
|||||||
var person Person
|
var person Person
|
||||||
// If `GET`, only `Form` binding engine (`query`) used.
|
// If `GET`, only `Form` binding engine (`query`) used.
|
||||||
// If `POST`, first checks the `content-type` for `JSON` or `XML`, then uses `Form` (`form-data`).
|
// If `POST`, first checks the `content-type` for `JSON` or `XML`, then uses `Form` (`form-data`).
|
||||||
// See more at https://github.com/gin-gonic/gin/blob/master/binding/binding.go#L48
|
// See more at https://github.com/softwear/gin/blob/master/binding/binding.go#L48
|
||||||
if c.ShouldBind(&person) == nil {
|
if c.ShouldBind(&person) == nil {
|
||||||
log.Println(person.Name)
|
log.Println(person.Name)
|
||||||
log.Println(person.Address)
|
log.Println(person.Address)
|
||||||
@ -901,12 +901,12 @@ $ curl -X GET "localhost:8085/testing?name=appleboy&address=xyz&birthday=1992-03
|
|||||||
|
|
||||||
### Bind Uri
|
### Bind Uri
|
||||||
|
|
||||||
See the [detail information](https://github.com/gin-gonic/gin/issues/846).
|
See the [detail information](https://github.com/softwear/gin/issues/846).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/softwear/gin"
|
||||||
|
|
||||||
type Person struct {
|
type Person struct {
|
||||||
ID string `uri:"id" binding:"required,uuid"`
|
ID string `uri:"id" binding:"required,uuid"`
|
||||||
@ -940,7 +940,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testHeader struct {
|
type testHeader struct {
|
||||||
@ -972,7 +972,7 @@ func main() {
|
|||||||
|
|
||||||
### Bind HTML checkboxes
|
### Bind HTML checkboxes
|
||||||
|
|
||||||
See the [detail information](https://github.com/gin-gonic/gin/issues/129#issuecomment-124260092)
|
See the [detail information](https://github.com/softwear/gin/issues/129#issuecomment-124260092)
|
||||||
|
|
||||||
main.go
|
main.go
|
||||||
|
|
||||||
@ -1248,7 +1248,7 @@ func main() {
|
|||||||
func main() {
|
func main() {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
router.GET("/someDataFromReader", func(c *gin.Context) {
|
router.GET("/someDataFromReader", func(c *gin.Context) {
|
||||||
response, err := http.Get("https://raw.githubusercontent.com/gin-gonic/logo/master/color.png")
|
response, err := http.Get("https://raw.githubusercontent.com/softwear/logo/master/color.png")
|
||||||
if err != nil || response.StatusCode != http.StatusOK {
|
if err != nil || response.StatusCode != http.StatusOK {
|
||||||
c.Status(http.StatusServiceUnavailable)
|
c.Status(http.StatusServiceUnavailable)
|
||||||
return
|
return
|
||||||
@ -1368,7 +1368,7 @@ You may use custom delims
|
|||||||
|
|
||||||
#### Custom Template Funcs
|
#### Custom Template Funcs
|
||||||
|
|
||||||
See the detail [example code](https://github.com/gin-gonic/examples/tree/master/template).
|
See the detail [example code](https://github.com/softwear/examples/tree/master/template).
|
||||||
|
|
||||||
main.go
|
main.go
|
||||||
|
|
||||||
@ -1379,7 +1379,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func formatAsDate(t time.Time) string {
|
func formatAsDate(t time.Time) string {
|
||||||
@ -1431,7 +1431,7 @@ r.GET("/test", func(c *gin.Context) {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
Issuing a HTTP redirect from POST. Refer to issue: [#444](https://github.com/gin-gonic/gin/issues/444)
|
Issuing a HTTP redirect from POST. Refer to issue: [#444](https://github.com/softwear/gin/issues/444)
|
||||||
```go
|
```go
|
||||||
r.POST("/test", func(c *gin.Context) {
|
r.POST("/test", func(c *gin.Context) {
|
||||||
c.Redirect(http.StatusFound, "/foo")
|
c.Redirect(http.StatusFound, "/foo")
|
||||||
@ -1600,8 +1600,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/gin-gonic/autotls"
|
"github.com/softwear/autotls"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -1624,8 +1624,8 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/gin-gonic/autotls"
|
"github.com/softwear/autotls"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
"golang.org/x/crypto/acme/autocert"
|
"golang.org/x/crypto/acme/autocert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1649,7 +1649,7 @@ func main() {
|
|||||||
|
|
||||||
### Run multiple service using Gin
|
### Run multiple service using Gin
|
||||||
|
|
||||||
See the [question](https://github.com/gin-gonic/gin/issues/346) and try the following example:
|
See the [question](https://github.com/softwear/gin/issues/346) and try the following example:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
@ -1659,7 +1659,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1742,7 +1742,7 @@ There are a few approaches you can use to perform a graceful shutdown or restart
|
|||||||
|
|
||||||
#### Third-party packages
|
#### Third-party packages
|
||||||
|
|
||||||
We can use [fvbock/endless](https://github.com/fvbock/endless) to replace the default `ListenAndServe`. Refer to issue [#296](https://github.com/gin-gonic/gin/issues/296) for more details.
|
We can use [fvbock/endless](https://github.com/fvbock/endless) to replace the default `ListenAndServe`. Refer to issue [#296](https://github.com/softwear/gin/issues/296) for more details.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
@ -1759,7 +1759,7 @@ Alternatives:
|
|||||||
|
|
||||||
#### Manually
|
#### Manually
|
||||||
|
|
||||||
In case you are using Go 1.8 or a later version, you may not need to use those libraries. Consider using `http.Server`'s built-in [Shutdown()](https://golang.org/pkg/net/http/#Server.Shutdown) method for graceful shutdowns. The example below describes its usage, and we've got more examples using gin [here](https://github.com/gin-gonic/examples/tree/master/graceful-shutdown).
|
In case you are using Go 1.8 or a later version, you may not need to use those libraries. Consider using `http.Server`'s built-in [Shutdown()](https://golang.org/pkg/net/http/#Server.Shutdown) method for graceful shutdowns. The example below describes its usage, and we've got more examples using gin [here](https://github.com/softwear/examples/tree/master/graceful-shutdown).
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// +build go1.8
|
// +build go1.8
|
||||||
@ -1775,7 +1775,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -1864,7 +1864,7 @@ func loadTemplate() (*template.Template, error) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See a complete example in the `https://github.com/gin-gonic/examples/tree/master/assets-in-binary` directory.
|
See a complete example in the `https://github.com/softwear/examples/tree/master/assets-in-binary` directory.
|
||||||
|
|
||||||
### Bind form-data request with custom struct
|
### Bind form-data request with custom struct
|
||||||
|
|
||||||
@ -1996,7 +1996,7 @@ enough to call binding at once.
|
|||||||
* This feature is only needed for some formats -- `JSON`, `XML`, `MsgPack`,
|
* This feature is only needed for some formats -- `JSON`, `XML`, `MsgPack`,
|
||||||
`ProtoBuf`. For other formats, `Query`, `Form`, `FormPost`, `FormMultipart`,
|
`ProtoBuf`. For other formats, `Query`, `Form`, `FormPost`, `FormMultipart`,
|
||||||
can be called by `c.ShouldBind()` multiple times without any damage to
|
can be called by `c.ShouldBind()` multiple times without any damage to
|
||||||
performance (See [#1341](https://github.com/gin-gonic/gin/pull/1341)).
|
performance (See [#1341](https://github.com/softwear/gin/pull/1341)).
|
||||||
|
|
||||||
### http2 server push
|
### http2 server push
|
||||||
|
|
||||||
@ -2009,7 +2009,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
var html = template.Must(template.New("https").Parse(`
|
var html = template.Must(template.New("https").Parse(`
|
||||||
@ -2062,7 +2062,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -2094,7 +2094,7 @@ func main() {
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -2166,7 +2166,7 @@ func TestPingRoute(t *testing.T) {
|
|||||||
|
|
||||||
## Users
|
## Users
|
||||||
|
|
||||||
Awesome project lists using [Gin](https://github.com/gin-gonic/gin) web framework.
|
Awesome project lists using [Gin](https://github.com/softwear/gin) web framework.
|
||||||
|
|
||||||
* [gorush](https://github.com/appleboy/gorush): A push notification server written in Go.
|
* [gorush](https://github.com/appleboy/gorush): A push notification server written in Go.
|
||||||
* [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform.
|
* [fnproject](https://github.com/fnproject/fn): The container native, cloud agnostic serverless platform.
|
||||||
|
2
auth.go
2
auth.go
@ -10,7 +10,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/softwear/gin/internal/bytesconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthUserKey is the cookie name for user credential in basic auth.
|
// AuthUserKey is the cookie name for user credential in basic auth.
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/testdata/protoexample"
|
"github.com/softwear/gin/testdata/protoexample"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/softwear/gin/internal/bytesconv"
|
||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/softwear/gin/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errUnknownType = errors.New("unknown type")
|
var errUnknownType = errors.New("unknown type")
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/softwear/gin/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnableDecoderUseNumber is used to call the UseNumber method on the JSON
|
// EnableDecoderUseNumber is used to call the UseNumber method on the JSON
|
||||||
|
@ -20,8 +20,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-contrib/sse"
|
"github.com/gin-contrib/sse"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
"github.com/gin-gonic/gin/render"
|
"github.com/softwear/gin/render"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Content-Type MIME of the most common data formats.
|
// Content-Type MIME of the most common data formats.
|
||||||
|
@ -22,11 +22,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-contrib/sse"
|
"github.com/gin-contrib/sse"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
testdata "github.com/gin-gonic/gin/testdata/protoexample"
|
testdata "github.com/softwear/gin/testdata/protoexample"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ context.Context = &Context{}
|
var _ context.Context = &Context{}
|
||||||
@ -353,7 +353,7 @@ func TestContextHandlerName(t *testing.T) {
|
|||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.handlers = HandlersChain{func(c *Context) {}, handlerNameTest}
|
c.handlers = HandlersChain{func(c *Context) {}, handlerNameTest}
|
||||||
|
|
||||||
assert.Regexp(t, "^(.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest$", c.HandlerName())
|
assert.Regexp(t, "^(.*/vendor/)?github.com/softwear/gin.handlerNameTest$", c.HandlerName())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContextHandlerNames(t *testing.T) {
|
func TestContextHandlerNames(t *testing.T) {
|
||||||
@ -364,7 +364,7 @@ func TestContextHandlerNames(t *testing.T) {
|
|||||||
|
|
||||||
assert.True(t, len(names) == 4)
|
assert.True(t, len(names) == 4)
|
||||||
for _, name := range names {
|
for _, name := range names {
|
||||||
assert.Regexp(t, `^(.*/vendor/)?(github\.com/gin-gonic/gin\.){1}(TestContextHandlerNames\.func.*){0,1}(handlerNameTest.*){0,1}`, name)
|
assert.Regexp(t, `^(.*/vendor/)?(github\.com/softwear/gin\.){1}(TestContextHandlerNames\.func.*){0,1}(handlerNameTest.*){0,1}`, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ func TestDebugPrintRoutes(t *testing.T) {
|
|||||||
debugPrintRoute("GET", "/path/to/route/:param", HandlersChain{func(c *Context) {}, handlerNameTest})
|
debugPrintRoute("GET", "/path/to/route/:param", HandlersChain{func(c *Context) {}, handlerNameTest})
|
||||||
SetMode(TestMode)
|
SetMode(TestMode)
|
||||||
})
|
})
|
||||||
assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param --> (.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest \(2 handlers\)\n$`, re)
|
assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param --> (.*/vendor/)?github.com/softwear/gin.handlerNameTest \(2 handlers\)\n$`, re)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDebugPrintRouteFunc(t *testing.T) {
|
func TestDebugPrintRouteFunc(t *testing.T) {
|
||||||
@ -74,7 +74,7 @@ func TestDebugPrintRouteFunc(t *testing.T) {
|
|||||||
debugPrintRoute("GET", "/path/to/route/:param1/:param2", HandlersChain{func(c *Context) {}, handlerNameTest})
|
debugPrintRoute("GET", "/path/to/route/:param1/:param2", HandlersChain{func(c *Context) {}, handlerNameTest})
|
||||||
SetMode(TestMode)
|
SetMode(TestMode)
|
||||||
})
|
})
|
||||||
assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param1/:param2 --> (.*/vendor/)?github.com/gin-gonic/gin.handlerNameTest \(2 handlers\)\n$`, re)
|
assert.Regexp(t, `^\[GIN-debug\] GET /path/to/route/:param1/:param2 --> (.*/vendor/)?github.com/softwear/gin.handlerNameTest \(2 handlers\)\n$`, re)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDebugPrintLoadTemplate(t *testing.T) {
|
func TestDebugPrintLoadTemplate(t *testing.T) {
|
||||||
|
@ -7,7 +7,7 @@ package gin
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BindWith binds the passed struct pointer using the specified binding engine.
|
// BindWith binds the passed struct pointer using the specified binding engine.
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
doc.go
2
doc.go
@ -3,4 +3,4 @@ Package gin implements a HTTP web framework called gin.
|
|||||||
|
|
||||||
See https://gin-gonic.com/ for more information about gin.
|
See https://gin-gonic.com/ for more information about gin.
|
||||||
*/
|
*/
|
||||||
package gin // import "github.com/gin-gonic/gin"
|
package gin // import "github.com/softwear/gin"
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/softwear/gin/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrorType is an unsigned 64-bit error code as defined in the gin spec.
|
// ErrorType is an unsigned 64-bit error code as defined in the gin spec.
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/softwear/gin/internal/json"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# Gin Examples
|
# Gin Examples
|
||||||
|
|
||||||
⚠️ **NOTICE:** All gin examples have been moved as standalone repository to [here](https://github.com/gin-gonic/examples).
|
⚠️ **NOTICE:** All gin examples have been moved as standalone repository to [here](https://github.com/softwear/examples).
|
||||||
|
4
gin.go
4
gin.go
@ -13,8 +13,8 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/softwear/gin/internal/bytesconv"
|
||||||
"github.com/gin-gonic/gin/render"
|
"github.com/softwear/gin/render"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultMultipartMemory = 32 << 20 // 32 MB
|
const defaultMultipartMemory = 32 << 20 // 32 MB
|
||||||
|
@ -6,8 +6,8 @@ This is API experiment for Gin.
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
"github.com/gin-gonic/gin/ginS"
|
"github.com/softwear/gin/ginS"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/softwear/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
|
10
gin_test.go
10
gin_test.go
@ -454,27 +454,27 @@ func TestListOfRoutes(t *testing.T) {
|
|||||||
assertRoutePresent(t, list, RouteInfo{
|
assertRoutePresent(t, list, RouteInfo{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: "/favicon.ico",
|
Path: "/favicon.ico",
|
||||||
Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$",
|
Handler: "^(.*/vendor/)?github.com/softwear/gin.handlerTest1$",
|
||||||
})
|
})
|
||||||
assertRoutePresent(t, list, RouteInfo{
|
assertRoutePresent(t, list, RouteInfo{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: "/",
|
Path: "/",
|
||||||
Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$",
|
Handler: "^(.*/vendor/)?github.com/softwear/gin.handlerTest1$",
|
||||||
})
|
})
|
||||||
assertRoutePresent(t, list, RouteInfo{
|
assertRoutePresent(t, list, RouteInfo{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: "/users/",
|
Path: "/users/",
|
||||||
Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$",
|
Handler: "^(.*/vendor/)?github.com/softwear/gin.handlerTest2$",
|
||||||
})
|
})
|
||||||
assertRoutePresent(t, list, RouteInfo{
|
assertRoutePresent(t, list, RouteInfo{
|
||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: "/users/:id",
|
Path: "/users/:id",
|
||||||
Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest1$",
|
Handler: "^(.*/vendor/)?github.com/softwear/gin.handlerTest1$",
|
||||||
})
|
})
|
||||||
assertRoutePresent(t, list, RouteInfo{
|
assertRoutePresent(t, list, RouteInfo{
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: "/users/:id",
|
Path: "/users/:id",
|
||||||
Handler: "^(.*/vendor/)?github.com/gin-gonic/gin.handlerTest2$",
|
Handler: "^(.*/vendor/)?github.com/softwear/gin.handlerTest2$",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
mode.go
2
mode.go
@ -8,7 +8,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnvGinMode indicates environment name for gin mode.
|
// EnvGinMode indicates environment name for gin mode.
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/softwear/gin/binding"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/softwear/gin/internal/bytesconv"
|
||||||
"github.com/gin-gonic/gin/internal/json"
|
"github.com/softwear/gin/internal/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
// JSON contains the given interface object.
|
// JSON contains the given interface object.
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
testdata "github.com/gin-gonic/gin/testdata/protoexample"
|
testdata "github.com/softwear/gin/testdata/protoexample"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO unit tests
|
// TODO unit tests
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/softwear/gin/internal/bytesconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// String contains the given interface object slice and its format.
|
// String contains the given interface object slice and its format.
|
||||||
|
2
tree.go
2
tree.go
@ -11,7 +11,7 @@ import (
|
|||||||
"unicode"
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin/internal/bytesconv"
|
"github.com/softwear/gin/internal/bytesconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -86,7 +86,7 @@ func TestFilterFlags(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFunctionName(t *testing.T) {
|
func TestFunctionName(t *testing.T) {
|
||||||
assert.Regexp(t, `^(.*/vendor/)?github.com/gin-gonic/gin.somefunction$`, nameOfFunction(somefunction))
|
assert.Regexp(t, `^(.*/vendor/)?github.com/softwear/gin.somefunction$`, nameOfFunction(somefunction))
|
||||||
}
|
}
|
||||||
|
|
||||||
func somefunction() {
|
func somefunction() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user