Commit Graph

1779 Commits

Author SHA1 Message Date
Thibault Jamet aa6002134e
Fix intercepting headers in middlewares (#1271)
* Fix intercepting headers in middlewares

As explained in the TestInterceptedHeader test, in case a middleware
filters out the headers, this middleware can be done inefficient in case
one following handler is using c.String or other methods writing to the
response body directly.

This commit fixes the issue by using c.Writer when writing the Status as
done in other c.Header, c.SetCookie and other response writers.

The bug has been originally discovered using
https://github.com/gin-contrib/gzip where a failing test has been added
here: https://github.com/tjamet/gzip/blob/header/gzip_test.go#L71

Signed-off-by: Thibault Jamet <tjamet@users.noreply.github.com>

* Skip Intercepted Header test for go <1.6

Signed-off-by: Thibault Jamet <tjamet@users.noreply.github.com>
2022-05-28 08:27:10 +08:00
Eric_Lee 87811a97bd
fix: the trusted proxies should support ipv6 address by default (#3033) 2022-05-28 08:14:35 +08:00
dependabot[bot] f1e942889a
chore(deps): bump golangci/golangci-lint-action from 3.1.0 to 3.2.0 (#3150)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-18 22:27:27 +08:00
micanzhang ef687e0db2
feat: automatically SetMode to TestMode when run go test. (#3139)
related issue: https://github.com/gin-gonic/gin/issues/3134
2022-05-14 09:11:35 +08:00
dependabot[bot] 90e7073d56
chore(deps): bump github/codeql-action from 1 to 2 (#3132)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-26 08:51:13 +08:00
dependabot[bot] c131704fd6
chore(deps): bump github.com/goccy/go-json from 0.9.6 to 0.9.7 (#3131)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-26 08:50:28 +08:00
Faisal Alam e61cc06955
feat(context): return GIN Context from Value method (#2825) 2022-04-23 18:02:54 +08:00
Lanco d8e053d15f
use StringToBytes func (#2798) 2022-04-23 18:01:41 +08:00
Kacper Bąk c706ace929
fix: removed YODA conditions, removed blank identifier from `invalid_obj` (#3129)
* fix: removed YODA conditions, unnecessary binding.binding

* fix: remove BindingBody change
2022-04-23 18:01:03 +08:00
mstmdev 444e156fb1
Fix some tests (#3100)
* Sleep for one millisecond in the handler because the `Latency` will return `0s` sometimes and the test will fail

* The `TCPListener.File` is not supported by windows, it is unimplemented now

* Remove the `LF` in the `testdata/template/raw.tmpl`, because if set the git config `core.autocrlf=true`, will append `CR` to the raw.tmpl automatically, then test is failed on Windows
2022-04-21 18:21:46 +08:00
dependabot[bot] 696d37e030
chore(deps): bump codecov/codecov-action from 2 to 3 (#3117)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-17 14:16:17 +08:00
dependabot[bot] 493b12482b
chore(deps): bump actions/setup-go from 2 to 3 (#3118)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-17 14:15:53 +08:00
ahuigo 6854212698
Fix: missing `sameSite` when do context.reset() (#3123) 2022-04-17 12:41:59 +08:00
Jonathan (JC) Chen 888b14ab28
docs: Update README.md (#3108) 2022-04-16 09:52:09 +08:00
dependabot[bot] c4580944ae
chore(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1 (#3094)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 14:03:54 +08:00
dependabot[bot] 6a1d279c28
chore(deps): bump github.com/goccy/go-json from 0.9.5 to 0.9.6 (#3105)
Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.9.5 to 0.9.6.
- [Release notes](https://github.com/goccy/go-json/releases)
- [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md)
- [Commits](https://github.com/goccy/go-json/compare/v0.9.5...v0.9.6)

---
updated-dependencies:
- dependency-name: github.com/goccy/go-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 14:03:30 +08:00
dependabot[bot] 3d55efe419
chore(deps): bump google.golang.org/protobuf from 1.27.1 to 1.28.0 (#3104)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-29 12:02:20 +08:00
dependabot[bot] 205bb8151c
chore(deps): bump actions/cache from 2 to 3 (#3093)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-25 08:44:37 +08:00
mstmdev 865fd560fc
Update some comments, add function name prefix to comment (#3090) 2022-03-23 21:35:09 +08:00
Bo-Yi Wu be0d86edf4
chore(CI/CD): add go1.18 version (#3092)
* chore(CI/CD): add go1.18 version

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* Update go.mod

* Update go.sum

* Update go.mod

* Update go.sum

Co-authored-by: thinkerou <thinkerou@gmail.com>
2022-03-21 17:38:11 +08:00
thinkerou 62265c893c
chore: support min version of go: 1.14 (#2964) 2022-03-21 10:51:17 +08:00
thinkerou 2bde107686
test support go1.18 (#2990) 2022-03-21 09:43:17 +08:00
dependabot[bot] 9701b651b7
Bump github.com/ugorji/go/codec from 1.2.6 to 1.2.7 (#3064)
Bumps [github.com/ugorji/go/codec](https://github.com/ugorji/go) from 1.2.6 to 1.2.7.
- [Release notes](https://github.com/ugorji/go/releases)
- [Commits](https://github.com/ugorji/go/compare/v1.2.6...v1.2.7)

---
updated-dependencies:
- dependency-name: github.com/ugorji/go/codec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-20 21:31:42 +08:00
Mike 1e24473f5f
Annotation fix (#3088)
* fix annotation

* fix annotation
2022-03-20 21:26:12 +08:00
dependabot[bot] d8dfaaeb2e
Bump golangci/golangci-lint-action from 2 to 3.1.0 (#3063)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-19 21:19:57 +08:00
a2tt f073e33fb9
fix: typo (#3086) 2022-03-18 17:41:09 +08:00
thinkerou fcd36c549d
fix: test error (#3087) 2022-03-18 11:55:25 +08:00
thinkgo 417b142703
feat: add StaticFileFS (#2749)
* RouterGroup.StaticFileFS added
add StaticFileFS ad README

* fix Static content mistake

* update README `tab`
improve StaticFile and StaticFileFS code, use staticFileHandler
2022-03-18 09:52:23 +08:00
metal A-wing 8860527de6
feat attachment filename support utf8 (#3071) 2022-03-17 11:56:16 +08:00
linzi 90330e2a76
Distinguish between group and nested group (#3083) 2022-03-17 11:55:08 +08:00
dependabot[bot] 7927a45143
Bump actions/checkout from 2 to 3 (#3068)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-16 23:19:06 +08:00
phithon ecadd82592
doc: change the form name of upload example code (#3076) 2022-03-15 11:24:17 +08:00
dependabot[bot] 5f0b6cdfc4
Bump github.com/goccy/go-json from 0.9.0 to 0.9.5 (#3069)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-12 20:42:58 +08:00
bestgopher 3757142584
Update routergroup.go (#3056) 2022-02-14 14:39:57 +08:00
thinkerou 87e40d6b15
feat: fix lint error (#3050) 2022-02-07 23:15:44 +08:00
涛叔 b40ded1837
Add h2c support (#1398) 2022-02-05 21:13:20 +08:00
Bo-Yi Wu c19374c471
feat(CodeQL): Discover vulnerabilities across a codebase with CodeQL (#3049)
* feat(CodeQL): Discover vulnerabilities across a codebase with CodeQL

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix: unknown directive: retract

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2022-02-05 20:57:13 +08:00
Sasha Melentyev b94075ff1d
ci: bump golangci-lint version (#3037) 2022-02-05 09:36:38 +08:00
MichaelDeSteven 41d38fb68c
fix typo (#3044) 2022-02-05 09:30:38 +08:00
Waynerv 580e7da6ee
Remove incorrect comments about context.Bind() and improve docs (#3028) 2022-01-20 22:33:35 +08:00
jarodsong6 1b28e2b030
Fix typo (#3023)
Co-authored-by: lin.song <lin.song@rakuten.com>
2022-01-12 22:12:32 +08:00
dependabot[bot] 336ce0d475
Bump github.com/goccy/go-json from 0.8.1 to 0.9.0 (#3021)
Bumps [github.com/goccy/go-json](https://github.com/goccy/go-json) from 0.8.1 to 0.9.0.
- [Release notes](https://github.com/goccy/go-json/releases)
- [Changelog](https://github.com/goccy/go-json/blob/master/CHANGELOG.md)
- [Commits](https://github.com/goccy/go-json/compare/v0.8.1...v0.9.0)

---
updated-dependencies:
- dependency-name: github.com/goccy/go-json
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-11 08:15:12 +08:00
dependabot[bot] 6868ed18cc
Bump github.com/go-playground/validator/v10 from 10.9.0 to 10.10.0 (#3013)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-08 17:25:31 +08:00
Bo-Yi Wu 94153d1e19
test: expose performRequest func (#3012) 2022-01-02 19:07:44 +08:00
jincheng9 01363191be
fix: typo (#3006) 2022-01-02 14:04:07 +08:00
jincheng9 d062a6a615
docs: redirect to the correct line of code (#2998) 2021-12-26 08:02:01 +08:00
linzi 1538ece13f
Update README.md (#2997) 2021-12-23 07:51:12 +08:00
jincheng9 8a0f95cc71
fix: typo (#2993) 2021-12-20 17:42:54 +08:00
jincheng9 92a988d761
fix: description error (#2988)
* fix:typo

* fix: typo

* fix: wrong when wildcard follows named param

* fix: description error

* update author list

* fix:typo

* fix: description error
2021-12-18 19:40:47 +08:00
jincheng9 fb5f045417
fix: description error (#2986) 2021-12-15 23:27:23 +08:00