Commit Graph

130 Commits

Author SHA1 Message Date
David Irvine ebe3580daf Add convenience method to check if websockets required (#779)
* Add convenience method to check if websockets required

* Add tests

* Fix up tests for develop branch
2017-01-02 16:05:30 +08:00
Bo-Yi Wu 5cc3d5955f Support upload single or multiple files.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-24 12:25:01 +08:00
Bo-Yi Wu 787bff85e5 fix testing.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-11 10:14:23 +08:00
Bo-Yi Wu 764e138e32 Merge pull request #755 from gin-gonic/755-app-engine-client-ip
Fix #723
2016-12-06 08:14:11 -06:00
Javier Provecho Fernandez 7e58c80a7c Fix #723 2016-12-06 14:28:01 +01:00
Javier Provecho Fernandez 273e43a27a Merge pull request #724 from chiffa-org/redundant_context_import
Move golang.org/x/net/context.Context interface implementation check to tests
2016-12-05 10:55:06 +01:00
Bo-Yi Wu e1efd4fce1 Merge pull request #707 from yehezkielbs/develop
Make CreateTestContext public without importing net/http/httptest
2016-12-05 16:48:30 +08:00
Bo-Yi Wu 6f474cb42d Merge pull request #570 from andreynering/array
Implement QueryArray and PostFormArray methods
2016-12-03 08:12:19 +08:00
Vyacheslav Dubinin ceb250ba20 Move golang.org/x/net/context.Context interface implementation check to tests 2016-10-19 17:13:38 +03:00
Yehezkiel Syamsuhadi 61ba9db5af Make CreateTestContext public without importing net/http/httptest 2016-09-21 12:16:51 +10:00
Javier Provecho Fernandez 9e930b9bdd lint code 2016-04-15 01:16:46 +02:00
Javier Provecho Fernandez 4df51ad4f8 Merge pull request #587 from roylou/develop
Write header immediately in AbortWithStatus(), close #585
2016-04-15 00:36:29 +02:00
Javier Provecho 007bd5124a closes #514, code from bobbo@b4f0b50 2016-04-14 23:47:49 +02:00
Roy Lou 4c4444b160 Write header immediately in AbortWithStatus()
Otherwise, caller needs to invoke WriteHeaderNow himself after
AbortWithStatus(), which is error-prone.

Also modified ErrorLoggerT() such that it always writes log to response
body. Otherwise calling AbortWithStatus() will fail to write body because
c.Writer.Written() is set true by WriteHeaderNow().
2016-04-15 00:02:29 +08:00
Andrey Nering 9366e33ffc Implement QueryArray and PostArray methods 2016-03-29 21:48:50 -03:00
Manu Mtz.-Almeida afc499f306 Adds GetQuery() and GetPostForm() APIs 2016-01-29 02:07:44 +01:00
Manu Mtz.-Almeida d64a1fb91c Cosmetic changes 2016-01-28 00:35:09 +01:00
Manu Mtz.-Almeida 97cd894279 c.Redirect() allows 201 status code 2016-01-28 00:34:05 +01:00
Manu Mtz.-Almeida d0065c712e Merge pull request #411 from phicode/vendoring
tests: make path assertions aware of vendoring
2016-01-27 03:22:48 +01:00
Javier Provecho Fernandez fe49f0b616 Fix exported test function 2015-10-02 12:39:25 +02:00
Javier Provecho Fernandez 4892650ef8 Merge branch 'se77en-master' into develop 2015-10-02 12:38:32 +02:00
Javier Provecho Fernandez 8e37eb8498 Fix tests for GetCookie() and SetCookie() 2015-10-02 12:37:51 +02:00
Javier Provecho Fernandez 45b72951af Merge branch 'master' of https://github.com/se77en/gin into se77en-master 2015-10-02 11:25:25 +02:00
Javier Provecho Fernandez ee820830d5 Merge branch 'danielalves-master' into develop 2015-10-02 10:26:23 +02:00
Javier Provecho Fernandez afbf1cf37d Merge branch 'master' of https://github.com/danielalves/gin into danielalves-master
Conflicts:
	context_test.go
2015-10-02 10:26:02 +02:00
Javier Provecho Fernandez 558d6b582f Merge branch 'fix' of https://github.com/donnpebe/gin into donnpebe-fix 2015-10-02 09:54:06 +02:00
Javier Provecho Fernandez 8553030656 Remove old test 2015-09-25 12:12:06 +02:00
Javier Provecho Fernandez 6db7a17513 Trying a new fix. 2015-09-25 12:04:55 +02:00
Javier Provecho Fernandez aa934766b4 Fix TestContextRenderSSE-2 in context_test.go 2015-09-25 11:43:07 +02:00
Damon Zhao 7bf9788326 fix ci 2015-08-27 16:16:16 +08:00
Damon Zhao f5b1fb44bb Add SetCookie and GetCookie method for Context 2015-08-27 16:04:50 +08:00
Philipp Meinen 9fd8aff56e tests: make path assertions aware of vendoring
The path of a package can change in a situation where
dependency vendoring is in use.
This change modifies gin's unit tests to allow such paths.
2015-08-23 00:13:41 +02:00
Manu Mtz-Almeida a97c239b7a fixes unit tests 2015-08-16 16:36:47 +02:00
Manu Mtz-Almeida 0873992f38 More unit tests for form binding 2015-07-08 04:26:37 +02:00
Manu Mtz-Almeida 0316b735c4 More unit tests 2015-07-03 04:20:18 +02:00
Manu Mtz-Almeida 8f3047814e Comments + IRoutes + IRouter + unexported AbortIndex 2015-07-02 20:24:54 +02:00
Manu Mtz-Almeida 13f57702d4 Adds more c.Next() just to be sure 2015-07-02 18:45:09 +02:00
Adam Dratwinski 050a55b006 Use c.Next() instead of c.index++ in UnitTest 2015-07-02 16:37:35 +02:00
Adam Dratwinski 74f5051cb5 Fix IsAborted() method 2015-07-02 13:37:11 +02:00
Donn Pebe c1719f7e20 Use only the ip part of request RemoteAddr 2015-07-02 01:48:21 +07:00
Manu Mtz-Almeida 95c08d5f84 Adds HandlerName() 2015-06-25 19:44:52 +02:00
Manu Mtz-Almeida a7c957af7d Adds supports for custom JSON Content-type 2015-06-13 04:29:10 +02:00
Manu Mtz-Almeida 70325deb98 c.ClientIP() performance improvement
benchmark                 old ns/op     new ns/op     delta
BenchmarkManyHandlers     4956          4463          -9.95%

benchmark                 old allocs     new allocs     delta
BenchmarkManyHandlers     16             13             -18.75%

benchmark                 old bytes     new bytes     delta
BenchmarkManyHandlers     256           216           -15.62%
2015-06-04 13:15:22 +02:00
danielalves f831ac80ac Exporting CreateTestContext 2015-06-02 17:16:51 -03:00
Manu Mtz-Almeida 766493c916 Fixes all unit tests 2015-05-31 22:35:49 +02:00
Manu Mtz-Almeida a843d320a5 Better unit tests for binding forms 2015-05-26 17:22:39 +02:00
Manu Mtz-Almeida ec1ce34d32 Merge branch 'multipart-form-data-fix' of https://github.com/konjoot/gin
- the merge was manually modified before committing.
2015-05-26 16:47:10 +02:00
Maksimov Sergey e46f4980b9 Restored support of multipart/form-data 2015-05-26 15:21:35 +03:00
Manu Mtz-Almeida 4c1447bc29 Fixes unit tests 2015-05-26 12:11:59 +02:00
Manu Mtz-Almeida 865ea804c9 Renames new API for query/postform and params. 2015-05-26 12:08:33 +02:00
Manu Mtz-Almeida 0a9030f9d7 ClientIP() must trim the white spaces 2015-05-24 15:35:08 +02:00
Manu Mtz-Almeida 80d3cc6b75 Adds test for single IP in X-Forwarded-For 2015-05-24 15:28:58 +02:00
Manu Mtz-Almeida 37b6f6c179 Fixing new errors API 2015-05-22 16:39:15 +02:00
Manu Mtz-Almeida b7205a6ec2 Fixes new errors API. 2015-05-22 03:43:39 +02:00
Manu Mtz-Almeida e94247f9ad New errors API!! 2015-05-22 03:25:21 +02:00
Manu Mtz-Almeida 5f76ba2022 Context.Engine renamed to Context.engine 2015-05-22 02:24:13 +02:00
Manu Mtz-Almeida 0cb52ccef7 Improves unit test coverage 2015-05-19 02:29:32 +02:00
Manu Mtz-Almeida acf0c2dbb0 Unit tests for errors.Errors() 2015-05-19 00:49:01 +02:00
Manu Mtz-Almeida 947b53d4a2 New Render API 2015-05-18 15:45:24 +02:00
Manu Mtz-Almeida 99694bb716 Fixes errors 2015-05-12 15:22:13 +02:00
Manu Mtz-Almeida 3df5dfdb7f Faster IndentedJSON + unit tests 2015-05-11 01:04:08 +02:00
Manu Mtz-Almeida c391520654 More unit tests for Context .Set and .Get 2015-05-07 16:00:37 +02:00
Manu Mtz-Almeida eb3e9293ed Renames []HandleFunc to HandlersChain 2015-05-07 11:30:01 +02:00
Manu Mtz-Almeida f414648384 - More unit tests
- Improves HTML debug render
- InputHolder removed
- More debug logs
2015-05-05 15:06:38 +02:00
Manu Mtz-Almeida 0a192fb0fa Tons of unit tests 2015-04-09 12:15:02 +02:00
Manu Mtz-Almeida 4d315f474b More unit tests 2015-04-08 14:24:49 +02:00
Manu Mtz-Almeida ac0ad2fed8 Improves unit tests 2015-04-08 02:58:35 +02:00
Manu Mtz-Almeida 9828435f70 Fixes failing unit test 2015-04-07 18:14:33 +02:00
Manu Mtz-Almeida c0e8cedc98 Updates Context tests 2015-03-31 20:12:10 +02:00
Manu Mtz-Almeida 3285007fbb Refactores context.go 2015-03-23 04:39:53 +01:00
Ethan Kan 70f280f880 Added support for unsigned integers in binding parameters of form posts. Also changed parsing of integer fields to take into account the size of the fields. 2015-02-09 15:13:05 -08:00
Javier Provecho Fernandez a5ec533a6a Merge pull request #200 from joiggama/feature/content-type-charset
Specify utf-8 as default on content type charset headers on renderers
2015-02-07 14:38:21 +01:00
Ignacio Galindo b69dde8e68 Specify utf-8 as content type charset on renderers 2015-01-29 20:14:13 -06:00
Remco e4f6e053d0 Fixed issue allowing to spoof ClientIP()
The X-Forwared-For can be used to spoof the real client ip. The middleware
introduced in this patch (which should only be used when having servers
in front of this servers) will filter all defined proxies (or local ip
addresses by default) and replace the RemoteAddr with the real client
ip.
2014-12-21 13:42:48 +01:00
Manu Mtz-Almeida 07a3961941 General refactoring 2014-10-08 21:37:26 +02:00
Manu Mtz-Almeida 8e5397bfa0 Adds in-code license 2014-08-29 19:49:50 +02:00
Manu Mtz-Almeida d85245b5aa Improves unit tests
- Reusing much more code
- More coverage
- Cleanup
- Fixes some cases
2014-08-18 19:48:48 +02:00
Sasha Myasoedov 685d2c99cf Added tests for JSON binding. 2014-08-11 13:26:11 +03:00
Sasha Myasoedov 80cf66cde6 Added test cases for context file, data, XML response writers. 2014-08-08 16:31:41 +03:00
Sasha Myasoedov 6abe841c1f Splited tests into separate files 2014-08-08 14:48:15 +03:00