Commit Graph

31 Commits

Author SHA1 Message Date
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
Zhu Xi 3fe928994b
Update the code logic for latestNode in tree.go (#2897) 2021-10-23 11:58:57 +08:00
Notealot 39181329de
Tidy: Complete TrustedProxies feature (#2887) 2021-10-06 09:37:25 +08:00
qm012 0a55865c3f
fix #2786 (#2796)
* update match rule

* add comments
2021-07-26 10:07:54 +08:00
qm012 d4ca9a0fb1
fix #2762 (#2767) 2021-07-23 06:58:15 +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
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
Jeff 4d2dad5961
test: fixed the TestUnixSocket test on windows (#2595)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-01-11 09:07:45 +08:00
Ronald Petty 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
thinkerou d5f12ac6d7
use http method constant (#2155)
* use http method constant

* fix typo
2019-11-29 07:50:49 +08:00
Dmitry Kutakov 393a63f3b0 Fix 'errcheck' linter warnings (#2093) 2019-10-27 13:58:59 +08:00
Manjusaka 79840bc1c6 support run HTTP server with specific net.Listener (#2023) 2019-09-30 09:12:22 +08:00
Dan Markham 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
Dmitry Kutakov 5acf660117 fix travis freeze on concurrent test (#1761) 2019-02-04 09:27:00 +08:00
Dmitry Kutakov b056a34bdc fix errcheck warnings (#1739) 2019-01-18 09:32:53 +08:00
Dmitry Kutakov 807368579f fix test - auto choose port number (#1719) 2018-12-28 10:26:29 +08:00
Yoshiki Nakagawa 66b47a8068 feat(server): Implements RunFd method (#1609) 2018-11-06 10:28:51 +08:00
Sergey Ponomarev 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
James Pettyjohn 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
Boris Borshevsky 6f94fd05c9 Linting and optimizing struct memory signature. (#1184)
* fix cleanPath spell (#969)

* linter and optimize structs
2017-11-29 10:50:14 +08:00
Bo-Yi Wu 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
Bo-Yi Wu 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
bigwheel 3a040f8550 Add integration test using httptest 2016-02-24 02:44:52 +09:00
Manu Mtz-Almeida 704d690ac0 Removes debug code in unit tests 2015-08-16 18:39:41 +02:00
Manu Mtz-Almeida ce2201c392 router.Run() can be called without parameters. #405 2015-08-16 16:19:51 +02:00
Manu Mtz-Almeida 21979d6a99 Completes integration test 2015-06-03 05:25:50 +02:00
Kevin Mulvey b235d14ca1 compare the byte array 2015-06-02 20:52:33 -04:00
Kevin Mulvey da5be64c9f test standard router 2015-05-31 17:50:26 -04:00
Kevin Mulvey b512566acf unix socket integration test 2015-05-31 17:50:26 -04:00