Commit Graph

1581 Commits

Author SHA1 Message Date
Sai 4a23c4f7b9 fix #1804 which is caused by calling middleware twice. (#1805)
Fix: https://github.com/gin-gonic/gin/issues/1804

`allNoRoute` contains middlewares such as `gin.Logger`, `gin.Recovery`, so on.  The correct code is to use `noRoute`.

cc: @MetalBreaker
2019-03-11 10:52:47 +08:00
田欧 70a0aba3e4
travisci: use go module when go11+ (#1800) 2019-03-08 23:18:52 +08:00
Sai f7079a861e Delete dupilicated test (#1801) 2019-03-08 19:44:39 +08:00
Adam Zielinski 3dc247893e make context.Keys available as LogFormatterParams (#1779)
* make context available as LogFormatterParams

* pass context Keys to LogFormatterParams

* update logger test to check for Key param
2019-03-07 09:47:31 +08:00
Riverside 057f63b1bb spell check (#1796)
* spell check

* variable path collides with imported package name

* spell check
2019-03-05 09:41:37 +08:00
田欧 a5dda62cdc
chore: use internal/json (#1791) 2019-03-05 06:46:18 +08:00
Dmitry Kutakov 805b2d4904 add support time.Duration on mapping (#1794) 2019-03-04 11:37:46 +08:00
Kumar McMillan f8f1459619 Fix URL to starter template in the docs (#1795) 2019-03-04 08:06:46 +08:00
田欧 df366c7840
chore: update go mod package (#1792) 2019-03-04 07:28:03 +08:00
Dmitry Kutakov 0d50ce8597 refactor(form_mapping.go): mapping ptr, struct and map (#1749)
* refactor(form_mapping.go): mapping ptr, struct and map

* fix #1672 correct work with ptr - not create value if field is not set
* avoid allocations on strings.Split() - change to strings.Index()
* fix #610 tag value "-" is mean ignoring field
* struct fields mapped like json.Unmarshal
* map fields mapped like json.Unmarshal

* fix after @thinkerou review
2019-03-03 14:39:43 +08:00
Daniel Krom 893c6cae07 Added stream flag indicates if client disconnected in middle of streaming (#1252) 2019-03-02 23:07:37 +08:00
Bo-Yi Wu 3b84a430d0 Drone switch from gin to go-chi in 1.0 version. (#1790) 2019-03-02 20:19:42 +08:00
田欧 8c8002d744 chore: add examples repo link to README (#1788) 2019-03-02 19:21:10 +08:00
Dang Nguyen 688eb1281c update examples link in README (#1789) 2019-03-02 16:04:21 +08:00
田欧 0feaf8cbd8
Split examples to alone repo (#1776)
* split examples to alone repo

* vendor

* fix package error

* add examples/README.md
2019-03-01 23:42:41 +08:00
Emmanuel Goh ccb9e90295 Extend context.File to allow for the content-dispositon attachments via a new method context.Attachment (#1260)
* Add FileAttachment method to context to allow instant downloads with filenames

* Add relevant tests for FileAttachment method
2019-03-01 10:17:47 +08:00
Equim 2dd3193006 Support negotiation wildcards, fix #391 (#1112)
* support negotiation wildcards, fix #391

* fix typo
2019-03-01 10:03:14 +08:00
田欧 9bacadd3ea remove docs dir (#1786)
the post doc move https://gin-gonic.com/blog/
2019-03-01 07:11:02 +08:00
Dmitry Kutakov 7dfa6c936a fix #1784: correct error comparison on tests (#1785) 2019-02-28 22:43:27 +08:00
Tudor Roman ccb105dbcb add prefix from X-Forwarded-Prefix in redirectTrailingSlash (#1238)
* add prefix from X-Forwarded-Prefix in redirectTrailingSlash

* added test

* fix path import
2019-02-27 19:56:29 +08:00
Raphael Gavache e207a3ce65 Fix context.Copy() race condition (#1020)
* Fix context.Copy race condition

* Update githubapi_test.go

* fix code format
2019-02-26 15:10:16 +08:00
Luis GG 62749f0db4 Add context.HandlerNames() (#1729)
* Add context.HandlerNames()

This change adds a HandlerNames method that will return all registered handles in the context, in descending order

This is useful for debugging and troubleshooting purposes, especially in large apps

* Tests

Add tests for HandlerNames

* Fix HandlerNames test

* Simplify test
2019-02-26 12:15:40 +08:00
田欧 d6adc8d0cc chore: add go1.12 support (#1780)
* chore: add go1.12 support

* Update .travis.yml
2019-02-26 10:45:44 +08:00
Sai e6288e90eb Change color methods in using defaultLogger function to public (#1771)
Fix https://github.com/gin-gonic/gin/issues/1768
2019-02-22 16:48:55 +08:00
songjiayang 7b1081a73f issue_1721: fix render writeHeaders to make it the same as http.Header.Set (#1722) 2019-02-22 14:20:24 +08:00
Pierre Massat 184661cfa2 Add response size to LogFormatterParams (#1752) 2019-02-22 13:12:05 +08:00
David Zhang d7daffc26b Use camel case instead of ALL_CAPS (#1419)
* Use camel case instead of ALL_CAPS

* Update mode.go
2019-02-22 12:53:47 +08:00
André Bazaglia 48f6c6137c allow ignoring field on form mapping (#1733) 2019-02-22 12:23:52 +08:00
Mara Kim 4e86b17e73 Set socket to recieve writes (#1134)
* Set socket to recieve writes

* Update gin.go
2019-02-22 11:45:32 +08:00
田欧 e6886e1539
chore: fix Make script when failed (#1774) 2019-02-21 20:32:55 +08:00
Olivier Robardet a58a2f9bf3 Add a function to force color in console output (#1724)
Add a function `ForceConsoleColor`, like `DisableConsoleColor` but to force coloring the output.

It usefull when some IDE's integrated console (like IntelliJ or Goland) are not detected as TTY, but can display colors.

Also helps if one want to output color in log file (#1590) and as a workaround for #1547.
2019-02-20 21:14:16 +08:00
ffhelicopter 90587c7787 Update: examples/graceful-shutdown/server.go (#1530)
* Update server.go

It's necessary that  catching  ctx.Done()

* Update server.go

* Update server.go

* Update README.md

* Update README.md
2019-02-20 13:24:29 +08:00
Jeremy Loy fece76d93f Add NewRelic middleware example. (#1526)
* Add NewRelic middleware example.

* Update go.mod

* Update main.go
2019-02-20 10:41:46 +08:00
awkj 5846ceba8b add notify accept signal (#1740)
* add notify accept signal

* add import

* update readme,keep same with example
2019-02-20 00:02:37 +08:00
Dmitry Kutakov 31bbb10f34 Make silent debug info on tests (#1765)
* make silent log on tests

* fix coverage: check end-of-line at the end of debug msg
2019-02-18 10:10:45 +08:00
Dmitry Kutakov a768f064d5 fix many redirects (#1760) (#1764)
* fix many redirects (#1760)

* fix @thinkerou review
2019-02-18 09:35:08 +08:00
Dmitry Kutakov 5acf660117 fix travis freeze on concurrent test (#1761) 2019-02-04 09:27:00 +08:00
田欧 d27685e714 chore: attempt to fix some gomod issue (#1751)
#1604 #1566 #1700 #1737 

because some dependencies only are used on example i.e. grpc.

Or migrate `examples` to gin-gonic/examples`?
2019-01-26 02:28:39 +08:00
Ryan f38a3fe65f fix password error (#1728) 2019-01-20 18:27:04 +08:00
Sai b4f5155982 Fix not to pass formatted string to Fprintf's format specifier parameter (#1747) 2019-01-20 08:39:09 +08:00
Dmitry Kutakov 4867ff9634 fix Context.Next() - recheck len of handlers every iteration (#1745)
* fix Context.Next() - recheck len of handlers every iteration

* add tests when Context.reset() can be called inside of handler

TestEngineHandleContext
TestContextResetInHandler
TestRouterStaticFSFileNotFound

* Context.Next() - format to while style
2019-01-18 09:57:06 +08:00
Dmitry Kutakov b056a34bdc fix errcheck warnings (#1739) 2019-01-18 09:32:53 +08:00
thinkerou 29a145c85d
Revert "context: inherits context cancelation and deadline from http.Request context for Go>=1.7 (#1690)" (#1736)
This reverts commit f67d7a90c4.
2019-01-09 09:32:44 +08:00
John Bampton d8fb18c33b Fix case of GitHub (#1726) 2018-12-31 09:02:53 +08:00
Bo-Yi Wu 85b92cdf4b
chore(testing): case sensitive for query string (#1720)
fix #1692
2018-12-29 11:46:26 +08:00
Dmitry Kutakov 807368579f fix test - auto choose port number (#1719) 2018-12-28 10:26:29 +08:00
Dmitry Kutakov 49e4b0c60c fix mapping inner structs with correct tag (#1718) 2018-12-28 09:57:09 +08:00
thinkerou 0bfc9cbcdb ci: exit 1 when build fail (#1695)
Like this:

```
FAIL	github.com/gin-gonic/gin [build failed]
```
2018-12-26 00:27:46 +08:00
thinkerou 1b34e8e8de chore: attemp to fix #1700 (#1707) 2018-12-25 23:40:11 +08:00
Sai 2d33c82028 Add comment to LogFormatterParams struct's fields (#1711)
By https://github.com/gin-gonic/gin/issues/1701, I thought it's necessary.
2018-12-25 23:27:24 +08:00