Commit Graph

1470 Commits

Author SHA1 Message Date
ziheng caf2802593
Improve router group tests (#2787) 2021-07-13 09:44:19 +08:00
Lanco f96678cb6b
use assert1 func (#2783) 2021-07-11 14:38:45 +08:00
ziheng 3116a2d7a1
use std http method constant instead of raw string (#2782) 2021-07-09 10:30:44 +08:00
ziheng c7a28f8532
use bit shift operation instead of division (#2776) 2021-07-06 16:37:14 +08:00
Helios 9d2883ef47
update the version of validator in the comment (#2780)
Co-authored-by: shangyilong <shangyilong@zuoyebang.com>
2021-07-06 16:36:32 +08:00
Lanco 9c27053243
byte alignment (#2774) 2021-07-04 10:37:13 +08:00
Lanco 372cc4a010
Fix typo (#2772) 2021-07-02 09:58:43 +08:00
voidman 690aa2b1b9
feat(binding): support custom struct tag (#2720)
* feat(binding): support custom struct tag

Add function `binding.MapFormWithTag` (#2719)

* doc: add 'bind form-data with custom struct tag'

Add 'Bind form-data request with custom struct and custom tag' section (#2719)

* test(binding): add test for MapFromWithTag
2021-06-30 00:53:56 +08:00
ziheng e3ee01d185
improve sliceValidateError.Error performance using switch and strings.Builder (#2765)
fix missing nil pointer check

use simpler switch case

add missing tests

use for-loop instead of range

add benchmark test codes
2021-06-28 22:05:29 +08:00
raymonder jin 1d0f938f28
Fix insufficient slice check (#2755) 2021-06-25 13:22:01 +08:00
ziheng f2bbdfe9f2
Use buf.String() instead of string(buf.Bytes()) (#2764) 2021-06-25 12:14:06 +08:00
wei 7834a03e84
gin.Context with fallback value from gin.Context.Request.Context() (#2751)
* Update tree.go (#2659)

delete more "()"

* updated comments for Get function for params (#2756)

* ci: add github action workflows (#2596)

* ci: add github action workflows

* test: fixed the TestUnixSocket test on windows (#20)

* ci: add github action workflows (#18)

* Remove .travis.yml

* ci: replace GITTER_ROOM_ID and upload coverage every time you go test

* ci: update coverage using codecov/codecov-action@v1

* Merge branch 'master' into github-actions

* repo: replace travis ci to github actions

* ci: add go version 1.16

* fix: go install requires a specific version

* chore(ci): remove go 1.12 support

* chore(ci): remove os windows-latest

Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* Setting trusted platform using an enum-like (#2739)

* gin.Context with fallback value from c.Request.Context()

* add test case

Co-authored-by: youzeliang <youzel@126.com>
Co-authored-by: Ashwani <ashwanisharma686@gmail.com>
Co-authored-by: Jeff <laojianzi1994@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
2021-06-24 16:33:14 +08:00
ziheng 09f6cff92a
skip unnecessary variable assignment in timeFormat (#2761) 2021-06-24 15:31:38 +08:00
ziheng be860ec157
fix typo and add comments (#2760) 2021-06-24 13:07:49 +08:00
Alessandro (Ale) Segala dd8a27c0b6
Setting trusted platform using an enum-like (#2739) 2021-06-24 08:58:10 +08:00
Jeff fb8a113f8d
ci: add github action workflows (#2596)
* ci: add github action workflows

* test: fixed the TestUnixSocket test on windows (#20)

* ci: add github action workflows (#18)

* Remove .travis.yml

* ci: replace GITTER_ROOM_ID and upload coverage every time you go test

* ci: update coverage using codecov/codecov-action@v1

* Merge branch 'master' into github-actions

* repo: replace travis ci to github actions

* ci: add go version 1.16

* fix: go install requires a specific version

* chore(ci): remove go 1.12 support

* chore(ci): remove os windows-latest

Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-06-23 13:10:49 +08:00
Ashwani a8857ed70a
updated comments for Get function for params (#2756) 2021-06-23 11:36:24 +08:00
youzeliang 61a0cda75a
Update tree.go (#2659)
delete more "()"
2021-06-23 06:44:39 +08:00
tyltr 34ce2104ca
optimize code and reduce code cyclomatic complexity (#2737)
* optimize code and reduce code cyclomatic complexity

* optimize if-condtion

Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-06-03 20:12:51 +08:00
heige 97a32b1de3
Optimize code adjust (#2700)
* setFormMap error of result

* adjust code for TrySet

* error export for type multipart.FileHeader

* code style adjust

* reflect code maping optimize

* Update form_mapping.go

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-06-02 07:35:30 +08:00
Alessandro (Ale) Segala 6703dea51c
Get client IP when using Cloudflare (#2723)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-05-28 10:03:59 +08:00
iamhesir 0cbb30aa94
Update default validator's docs link (#2738)
The default validator has upgraded from v8 to v10, but its docs link didn't.
2021-05-26 18:46:13 +08:00
yiranzai b5ca989875
set engine.TrustedProxies For items that don't use gin.RUN (#2692)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-25 13:47:35 +08:00
Don2Quixote 328d0b8076
Fixed typo in documentation (#2733) 2021-05-24 16:55:54 +08:00
sunshineplan f07a4f8aea
Upgrade github.com/ugorji/go/codec (#2732) 2021-05-24 08:31:22 +08:00
y-yagi 168edcad80
Check multipart file header size on test (#2716)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-05-23 11:44:41 +08:00
likakuli f13e53bb92
upgrade validator to v10.6.1 (#2729)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-23 09:54:54 +08:00
tyltr afb38396b5
optimize code (#2722)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-22 13:17:19 +08:00
Bo-Yi Wu e72e584d1a
chore(docs): bump to v1.7.2 (#2724)
* chore(docs): bump to v1.7.2

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

* chore: add change log

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-20 07:57:55 +08:00
yugu d7091e7dec
README.md update (#2715)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-19 10:57:23 +08:00
Yue Yang 2921582d11
Fix conflict between param and exact path (#2706)
* Fix conflict between param and exact path

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* Add test

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* Fix prefix conflict in exact paths

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* Use backtracking

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>

* Fix panic

Signed-off-by: Yue Yang <g1enyy0ung@gmail.com>
2021-05-19 10:05:36 +08:00
y-yagi 4fe5f3e4b4
Use `Duration.Truncate` for truncating precision (#2711)
`Duration.Truncate` was added in Go 1.9 and Gin required Go version 1.13+ now.
So we can use `Duration.Truncate`.

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-04 22:38:14 +08:00
y-yagi 5452a1d3ef
Add note about `nomsgpack` tag to the readme (#2703)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-01 14:13:50 +08:00
y-yagi 1acb459c10
Fix example code of `Bind Uri` (#2710)
Need to pass a string to `gin.H` to show a message correctly.
2021-05-01 13:57:22 +08:00
Qt 215c9ce231
use errors.New to replace fmt.Errorf will much better (#2707) 2021-04-28 18:39:09 +08:00
zzjin c0418c48e4
Add support go-json, another drop-in json replacement. (#2680)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-04-21 08:45:49 +08:00
heige f1da692fbd
RouterGroup.Handle regular match optimization of http method (#2685)
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-04-21 08:24:55 +08:00
y-yagi 7313b8fddc
Use `Header()` instead of deprecated `HeaderMap` (#2694)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-04-21 07:55:08 +08:00
thinkerou 77649bcfee
support Go v1.16 version (#2638) 2021-04-21 07:38:54 +08:00
thinkerou ee4de846a8
Remove go1.12 support (#2679)
* Revert "Adding ppc64le architecture support on travis-ci (#2538)"

This reverts commit fca3f95d7c.

* not support go1.12

* fix

* Update errors_test.go

* Update debug.go
2021-04-12 00:29:34 +08:00
thinkerou 51c7d001e0
bump to v1.7.1 (#2678) 2021-04-09 07:38:13 +08:00
Xudong Cai 03e5e05ae0
fix: data race with trustedCIDRs (#2674) (#2675)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-04-09 00:27:34 +08:00
Bo-Yi Wu d496f64540
bump to v1.7.0 version (#2672) 2021-04-08 15:47:41 +08:00
Manu MA bfc8ca285e
feat(engine): add trustedproxies and remoteIP (#2632)
Co-authored-by: Søren L. Hansen <soren@linux2go.dk>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Javier Provecho Fernandez <javiertitan@gmail.com>
2021-04-06 11:37:25 +08:00
Ross Wolf f3de8132c5
Add mixed param and non-param paths (port of httprouter#329) (#2663)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-04-06 10:49:08 +08:00
Ni Hao a331dc6a31
chore: remove duplicate test 'assert.Equal' (#2617)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-03-27 14:41:31 +08:00
thinkerou ed6f85c478
build: convert to go:build directives (#2664) 2021-03-27 09:09:44 +08:00
Andy Pan 1bdf86b722
Remove the tedious named return value (#2620)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-02-08 23:24:22 +08:00
Alexander Melentyev e899771392
chore: Deleted spaces (#2622) 2021-01-27 09:58:21 +08:00
Snawoot b01605bb5b
basic auth: fix timing oracle (#2609)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-01-13 09:40:37 +08:00