Commit Graph

1385 Commits

Author SHA1 Message Date
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
Bo-Yi Wu 91a4459dd2
remove allow fail flag (#1573)
golang team revert the net/url issue: https://github.com/golang/go/issues/27302
2018-09-27 09:58:47 +08:00
田欧 b7314d943c chore: fix debug test error (#1574) 2018-09-27 09:42:41 +08:00
Bo-Yi Wu 402ef120e1
fix: fmt output log to os.Stderr (#1571)
fix #1560 changes are breaking in App Engine.

cc @giulianobr @philippgille
2018-09-27 08:59:44 +08:00
田欧 834a2ec64c
feat: add go version judge when print debug warning log (#1572)
* feat: add go version judge when print debug warning log

* remove invalid statement

* use one const
2018-09-26 13:49:11 +08:00
andrea fd599fccea Make logger use a yellow background and a darkgray text for legibility (#1570)
1. Why is this change neccesary?
White text on a yellow background was illegible with most terminal color schemes

2. How does it address the issue?
The white text was replaced with a bash compatible dark gray while keeping the
yellow background colour

3. What side effects does this change have?
Resolves #1552
2018-09-26 10:28:25 +08:00
田欧 b02e4f2ed6
ci: fast finish when build failed (#1568) 2018-09-25 21:52:21 +08:00
Dustin Decker ad53619b15 Don't log requests (#1370)
Fixes #1331

HTTP logging leaks sensitive request information.

This PR removes HTTP request logging during panics.
2018-09-23 15:15:23 +08:00
田欧 5a75dc7127
add release badge for readme (#1533) 2018-09-22 11:37:28 +08:00
田欧 a210eea3bd
improve panic information when a catch-all wildcard conflict occurs (#1529) 2018-09-21 10:21:59 +08:00
田欧 f2cd3fcb2a chore: fix typo and add a little anotation (#1562) 2018-09-20 11:53:58 +08:00
Javier Provecho Fernandez c617b6241a chore: recover go master build, partial revert #1514 (#1561)
* chore: recover go master build, partial revert #1514

* chore: add master to go branch build targets
2018-09-20 09:13:04 +08:00
Bo-Yi Wu 07f1bf0e63
feat: replace debug log with fmt package. (#1560) 2018-09-19 13:57:00 +08:00
田欧 b27b7026c7
chore: add a version file includes gin version (#1549)
* chore: add a version file includes gin version

* update version for dev version
2018-09-17 15:08:11 +08:00
Jérôme Laforge 90c680ef5c Let's user define how he wants to log his routes (eg. JSON, key value, or something else) (#1553) (#1555) 2018-09-17 12:09:34 +08:00
田欧 7c7f703cc5
initial go.mod module definition (#1554) 2018-09-16 23:22:54 +08:00
田欧 6db092f778 chore: add some annotations (#1550)
ref #1075 should all annotations and can close #1075 .
2018-09-15 15:21:54 +08:00
田欧 d510595aa5 chore: add some annotations (#1544)
ref: #1075 
because I am not a native English, maybe have a bit problem.
2018-09-15 10:23:32 +08:00
Iskander (Alex) Sharipov 3f27866f80 simplify slice expressions: s[:] => s (#1541)
Found using https://go-critic.github.io/overview#unslice-ref
2018-09-12 21:21:26 +08:00
Iskander (Alex) Sharipov df1e17c2f0 remove debug print statements from test code (#1540)
Found using https://go-critic.github.io/overview#commentedOutCode-ref
2018-09-12 09:13:16 +08:00
Javier Provecho Fernandez 500ebd9ea8
docs: add fnproject to gin's user list (#1505) 2018-08-31 22:38:16 +02:00
田欧 705e199298 chore: update issue_implate (#1524) 2018-09-01 00:40:33 +08:00
田欧 7451a402bb chore: update vendor version (#1520)
#1491 adds some lib when upgrade json-iterator but it is not needed, and use `v1.1.5` not `1.1.5` version for json-iterator.
2018-08-30 23:36:53 +08:00
田欧 72db8acd99
add internal package which includes json package (#1504) 2018-08-30 19:04:03 +08:00
llgoer 708b76adf0 Update README.md (#1509)
change  `ShouldBindXML` to `ShouldBindJSON`
2018-08-30 14:29:26 +08:00
Bo-Yi Wu 09d342abbc Add golang 1.11.x testing (#1514)
* Add golang 1.11.x testing

* remove the latest golang testing

See the issue: https://github.com/gin-gonic/gin/pull/1510
2018-08-30 14:22:51 +08:00
anoty 0da5b0c85a format readme code import (#1503) 2018-08-21 13:29:25 +08:00
田欧 85f3e78abc chore: remove else instead of return/continue (#1502)
As[ Effective Go](https://golang.org/doc/effective_go.html?#if) about `if` said, remove else statement instead of return/continue statement.
2018-08-20 21:49:24 +08:00
junfengye 0ebd42d0a9 Update jsoniter.go (#1500)
add newencoder to fix compile error for -tags=jsoniter
2018-08-20 18:25:45 +08:00
Filip Figiel c6110f970c Add PureJSON renderer (#694)
Closes #693
2018-08-20 15:15:31 +08:00
田欧 b7bb9baa64
chore: add missing copyright and update if/else (#1497) 2018-08-19 22:52:43 +08:00
田欧 32b58e0fd2 render: update msgpack usage (#1498)
please see msgpack usage: https://github.com/ugorji/go/tree/master/codec#usage
2018-08-19 22:14:02 +08:00
田欧 6073a79ee0
not use protobuf on context but use it on render (#1496) 2018-08-19 17:39:58 +08:00
aljun efdd3c8b81 Add support for Protobuf format response and unit test (#1479)
`Gin` now have the `protobufBinding` function to check the request format, but didn't have a protobuf response function like `c.YAML()`.
In our company [ByteDance](http://bytedance.com/), the largest internet company using golang in China, we use `gin` to transfer __Protobuf__  instead of __Json__, we have to write some internal library to make some wrappers to achieve that, and the code is not elegant. So we really want such a feature.
2018-08-19 10:45:56 +08:00
chainhelen f856aa85cd Update readme about the version of gin (#1494) 2018-08-17 14:59:55 +08:00
David Zhang f5451bd645 Fix typo in README [ci skip] (#1492) 2018-08-17 11:33:23 +08:00
Eason Lin a643d20605 readme: fix users link (#1493) 2018-08-17 11:21:14 +08:00
Alexander Lokhman 7eb0f74b89 Set default time format in form binding (#1487) 2018-08-17 09:41:56 +08:00
syssam 40ab9de4b5 Add BindXML AND ShouldBindXML #1484 (#1485)
Add BindXML AND ShouldBindXML #1484
2018-08-17 09:12:15 +08:00
田欧 bef6c56c89 chore: upgrade dependency library version (#1491)
upgrade lib version, and upgrade `github.com/json-iterator/go` to add two libs.
2018-08-16 17:38:17 +08:00
Abner Chen 64a4548642 Fix typo in readme (#1490) 2018-08-15 13:42:12 +08:00
Javier Provecho Fernandez b869fe1415
docs: add changelog for v1.3.0, update authors and version const (#1478)
* docs: add changelog for v1.3.0, update authors and version const

*  add link for every referenced pull request (#1481)

* docs: add changelog for v1.3.0, update authors and version const

* add link for pr
2018-08-14 10:58:52 +02:00
田欧 6c8a973134
add issue and pull request template explain (#1483)
* add issue/pr template explain

* add issue/pr template explain
2018-08-14 11:35:13 +08:00
田欧 f45c928a15 chore: use http.Status* instead of hard code (#1482) 2018-08-14 09:51:56 +08:00
Alex 8aef947f6e docs: remove double negative in README.md (#1480)
"not match neither" means that it will match.
2018-08-12 22:54:22 +02:00
田欧 6159213462 unify test data (#1417)
mkdir a test data dir.
2018-08-12 23:38:31 +08:00
田欧 1ae32f3a2c improve render code coverage (#1474)
all code coverage > 99%
2018-08-12 22:02:37 +08:00
田欧 202db4fb11 improve utils code coverage (#1473) 2018-08-12 21:38:07 +08:00
田欧 e5bb4f62a2 chore: add return or remove else for reduce indent (#1470) 2018-08-12 21:17:57 +08:00
田欧 7e64d32269 Attempt to fix #1462 (#1463)
#1462
2018-08-12 10:12:33 +08:00