1252 Commits

Author SHA1 Message Date
Ganlv
bf113a6d08 Merge branch 'master' of git@github.com:ganlvtech/gin.git 2019-04-24 19:50:11 +08:00
Ganlv
e033d889c3 Add HTMLRender ParseFiles and ParseGlob test
Add LoadHTMLGlobAppendZeroParamsPanics test
2019-04-24 19:46:12 +08:00
Ganlv
4b4054af49 Remove unused Delims field in HTMLProduction struct 2019-04-24 19:44:19 +08:00
Ganlv
621569aa4a
Merge branch 'master' into master 2019-04-24 18:47:11 +08:00
Ganlv
8f7bee33ba Update README.md for LoadHTMLGlobAppend
LoadHTMLGlobAppend
LoadHTMLFilesAppend
2019-04-23 23:27:29 +08:00
Ganlv
7164a53b54 Add LoadHTMLGlobAppend and LoadHTMLFilesAppend to gin.Engine
Load new html templates to the exists HTMLRender.
This method won't create a new template instance.
So we can load templates from different path and use
golang template `define` tag to give the templates
proper name. Golang's `filepath.Glob` doesn't
support glob dir recursively. This method may be
helpful.

May be related with #1296.
2019-04-23 22:38:14 +08:00
John Bampton
11407e73ad Fix spelling. (#1861) 2019-04-22 23:11:57 +08:00
Abhishek Chanda
f9de6049cb Remove contents of the Authorization header while dumping requests (#1836)
This PR replaces the contents of that header with a *. This prevents
credential leak in logs.
2019-04-18 10:45:37 +08:00
Eason Lin
ffcbe77b1e chore(readme): rollback readme (#1846)
#1844 #1838 
Keep the documentation in readme until full available on the new website.
2019-04-06 21:48:33 +08:00
Dmitry Kutakov
2e915f4e50 refactor(form_mapping.go): mapping multipart request (#1829)
* refactor(form_mapping.go): mapping multipart request

* add checkers for a types to match with the setter interface

* form_mapping.go: rename method name on setter interface, add comments

* fix style of comments
2019-04-02 09:01:34 +08:00
Dan Markham
ce20f107f5 Truncate Latency precision in long running request (#1830)
fixes #1823
2019-03-28 14:14:00 +08:00
田欧
1d462bbe37
chore: update ginS (#1822) 2019-03-21 15:12:06 +08:00
田欧
0c1f3c4e81 chore: fix invalid link (#1820) 2019-03-20 12:07:34 +08:00
Sai
b40d4c175c IsTerm flag should not be affected by DisableConsoleColor method. (#1802)
* IsTerm flag should not be affected by DisableConsoleColor method.

* change public property to private
2019-03-18 11:12:30 +08:00
Boyi Wu
c16bfa7949 update for supporting file binding (#1264)
update for supporting multipart form and file binding 

example:
```
type PhoptUploadForm struct {
	imgData    *multipart.FileHeader `form:"img_data" binding:"required"`
	ProjectID   string `form:"project_id" binding:"required"`
	Description string `form:"description binding:"required"`
}
```


ref: https://github.com/gin-gonic/gin/issues/1263
2019-03-18 10:16:34 +08:00
sekky0905
bcf36ade9f Remove sudo setting from travis.yml (#1816) 2019-03-16 16:09:10 +08:00
David Zhang
05b5c3ba74 Doc: fix gin example notice syntax (#1814) 2019-03-15 15:39:34 +08:00
Sai
242a2622c8 Fix Japanese text hiragana -> kanji (#1812) 2019-03-14 16:26:51 +08:00
Dmitry Kutakov
483f828bce add support arrays on mapping (#1797)
* add support arrays on mapping

* not allow default value on array mapping
2019-03-14 13:34:56 +08:00
田欧
cab0749b4f
chore: update readme (#1793)
* update readme

* add multi-language version doc link

* add multi-language version doc link

* update readme

* update

* update readme

* update readme

* update readme
2019-03-14 13:23:35 +08:00
田欧
e5261480fd
chore(readme.md): fix invalid link (#1807) 2019-03-12 14:01:12 +08:00
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