36 Commits

Author SHA1 Message Date
5f55c6a711 ci(lint): enable testifylint linter (#4010)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-07-14 20:33:08 +08:00
4621b7ac98 feat(router): add literal colon support (#1432) (#2857) 2024-06-01 13:44:57 +08:00
3ac729dc4a feat(gin): support http3 using quic-go/quic-go (#3210)
* experimental support http3

* remove go1.14 and go1.15

* update quic-go package path

* only support go1.19+

* remove go19 support

* update gomod

* chore: refine CI configuration and dependencies

- Remove dynamic Go versioning in favor of pinning to major version `1`
- Update linter version from `v1.56.2` to `v1.58.1` in GitHub Actions workflow

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

* chore: refactor CI workflow and improve tests

- Update the golangci-lint-action version from `v5` to `v6` in the GitHub workflow configuration

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

* chore: update dependencies and CI configurations

- Update Go version requirement from `1.20` to `1.21` in `go.mod`

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

* style: refactor codebase and update tests

- Add an empty line in the import section of `gin.go`

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

* chore: enhance code quality and consistency

- Add `gin.go` to the list of files with specific linters in `.golangci.yml`, applying the `gci` linter.

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

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-09 09:17:06 +08:00
Qt
6150c488e7 remove deprecated of package io/ioutil (#3395) 2022-11-17 22:35:55 +08:00
4b68a5f12a chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
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
3fe928994b Update the code logic for latestNode in tree.go (#2897) 2021-10-23 11:58:57 +08:00
39181329de Tidy: Complete TrustedProxies feature (#2887) 2021-10-06 09:37:25 +08:00
0a55865c3f fix #2786 (#2796)
* update match rule

* add comments
2021-07-26 10:07:54 +08:00
d4ca9a0fb1 fix #2762 (#2767) 2021-07-23 06:58:15 +08:00
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
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
4d2dad5961 test: fixed the TestUnixSocket test on windows (#2595)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-01-11 09:07:45 +08:00
4427ca4a60 Update gin_integration_test.go (#2341)
* Update gin_integration_test.go

TestUnixSocket fails if you run it twice in a row.  This is due to the unix socket file persisting.  Added defer to clean up.

Whats unclear is the following test TestBadUnixSocket I suspect is just looking for cruft maybe from a prior test or defaults not working, I have not enough background to say.

* Update gin_integration_test.go

I believe there is some tab issue here, tried to manual overwrite it now.

* Update gin_integration_test.go

squash you dang spaces!!!
2020-04-28 09:36:04 +08:00
d5f12ac6d7 use http method constant (#2155)
* use http method constant

* fix typo
2019-11-29 07:50:49 +08:00
393a63f3b0 Fix 'errcheck' linter warnings (#2093) 2019-10-27 13:58:59 +08:00
79840bc1c6 support run HTTP server with specific net.Listener (#2023) 2019-09-30 09:12:22 +08:00
094f9a9105 v1.4.0 + #1631 (remove go1.6/go1,7 support) (#1851)
* remove go1.6 support

* remove build tag

* remove todo

* remove go1.6 support: https://github.com/gin-gonic/gin/pull/1383/commits

* update readme

* remove go1.7 support

* fix embedmd error

* test

* revert it

* revert it

* remove context_17

* add pusher test

* v1.4.0 rc1
2019-05-07 18:32:32 +08:00
5acf660117 fix travis freeze on concurrent test (#1761) 2019-02-04 09:27:00 +08:00
b056a34bdc fix errcheck warnings (#1739) 2019-01-18 09:32:53 +08:00
807368579f fix test - auto choose port number (#1719) 2018-12-28 10:26:29 +08:00
66b47a8068 feat(server): Implements RunFd method (#1609) 2018-11-06 10:28:51 +08:00
cfa092f4f0 Fix LoadHTML* tests (#1559)
Digging into the test code base I've found out that some of the tests for `LoadHTML*` methods are not reliable and efficient. They use timeouts to be sure that goroutine with the server has started. And even more, in old implementation, the server started only once – all the new instances silently failed due to the occupied network port.

Here is a short overview of the proposed changes: 
- it's not necessary to rely on timeouts, the server starts listening synchronously and returns control when it is ready
- once the server is run, it's stopped after a test passes
- dry out http server setup
- magic with empty closure return is eliminated 
- preserve router.RunTLS coverage with integration tests
2018-10-16 08:48:41 +08:00
e9f187f60a removed use of sync.pool from HandleContext and added test coverage (#1565)
As per #1230 there is an issue when using HandleContext where the context of the request is returned to the context sync.Pool before the parent request has finished, causing context to be used in a non-thread safe manner.

I've removed the bug by not entering the context back in the pool and leaving that to ServeHTTP.

There was no test coverage for this function so I've also added the test to cover it. As the bug only happens when there are concurrent requests, the tests issues hundreds of concurrent requests. Without the bug fixed the tests do consistently recreate the error.
2018-10-01 10:49:39 +08:00
6f94fd05c9 Linting and optimizing struct memory signature. (#1184)
* fix cleanPath spell (#969)

* linter and optimize structs
2017-11-29 10:50:14 +08:00
1e1e4fc867 Add Makefile to check the following thing (#947)
* Add Makefile to check the following thing.

* vet check
* fmt check
* embedmd check
* misspell check

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

* remove unused variable.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-06-12 21:50:42 -05:00
4ad3baf44e Add license for some files (#940) 2017-06-12 01:04:52 -05:00
d922143bc5 lint code for import (#939) 2017-06-11 21:40:15 -05:00
b8be9df642 docs: add graceful-shutdown example for go 1.8 (#835)
* docs: add graceful-shutdown example for go 1.8

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-03-16 10:38:30 -05:00
3a040f8550 Add integration test using httptest 2016-02-24 02:44:52 +09:00
704d690ac0 Removes debug code in unit tests 2015-08-16 18:39:41 +02:00
ce2201c392 router.Run() can be called without parameters. #405 2015-08-16 16:19:51 +02:00
21979d6a99 Completes integration test 2015-06-03 05:25:50 +02:00
b235d14ca1 compare the byte array 2015-06-02 20:52:33 -04:00
da5be64c9f test standard router 2015-05-31 17:50:26 -04:00
b512566acf unix socket integration test 2015-05-31 17:50:26 -04:00