Commit Graph

1181 Commits

Author SHA1 Message Date
Sai 678e09c736 Plural is "Paths", not "Pathes" (#1706) 2018-12-20 17:54:08 +08:00
Ganlv 1542eff27f Fix #1693: file.Filename should not be trusted (#1699) 2018-12-17 08:13:07 +08:00
Romain Beuque f67d7a90c4 context: inherits context cancelation and deadline from http.Request context for Go>=1.7 (#1690)
*gin.Context implements standard context.Context methods, but always
returns data as context is still valid. Since Go 1.7, http.Request now
contains a context.Context object, which can be controlled by the
http.Server to indicates that the context is now closed, and persue of
request should be canceled.

This implements the propagation of http.Request context methods inside
gin.Context to have HTTP context cancelation information at gin.Context
level.

Signed-off-by: Romain Beuque <romain.beuque@corp.ovh.com>
2018-12-13 11:20:17 +08:00
thinkerou 59695e7ba8
Add BindUri (#1694)
* add BindUri

* fix bug

* fix code style
2018-12-12 23:40:29 +08:00
Sai f76ccb25f1 Add LoggerWithFormatter method (#1677)
* Add LoggerWithFormatter

* Add tests for LoggerWithFormatter & LoggerWithConfig

* Add note for README

* Add tests for DefaultLogFormatter

* Add comment

* Change DefaultLogFormatter to a private method
2018-12-12 09:05:16 +08:00
thinkerou cce49582d6 ci: break when test fail (#1671) 2018-12-05 13:49:03 +08:00
thinkerou 98c7ac7202
fix bug (#1682) 2018-12-05 13:36:49 +08:00
thinkerou f463d847c2
chore: fix test fail (#1669)
* chore: fix test fail

* fix binduri test fail
2018-12-05 05:58:35 +08:00
thinkerou 54e9610400 chore: remove wercker yml file (#1676)
Now the `wercker.yml` have no longer used.
2018-12-05 02:02:03 +08:00
MetalBreaker b97ccf3a43 Router: Route StaticFS() not found to Router's NoRoute() (#1663)
Closes #1220
2018-11-26 23:01:51 +08:00
thinkerou 149ef75cdd
doc: remove README_ZH.md (#1667) 2018-11-26 21:05:54 +08:00
weibaohui 465ead47d0 doc: update README_ZH.md (#1659) 2018-11-25 21:18:00 +08:00
thinkerou 687d8b9ac6 add picfit to gin user list (#1661)
agreed with the project's author.
cc @thoas
thanks!
2018-11-25 20:52:46 +08:00
thinkerou 331af2219c add krakend to gin user list (#1658) 2018-11-24 13:49:26 +01:00
weibaohui f52bea87f6 调整描述语句 (#1657)
调整描述语句
2018-11-24 19:15:19 +08:00
尹宝强 1f576fb27c 修改连接错误,修正一些报引用错误 (#1655)
修复了全角括号导致超链接不能正常访问的错误。
修复了一些URL中的"/"被改成" / "的错误。
修复了一些包引用中"/"被改成" / "的错误。
修复有超链接被翻译成中文的错误。
2018-11-23 09:46:41 +08:00
long-road 6053156eed add chinese docs (#1588) 2018-11-22 23:42:41 +08:00
mllu 64457fbca7 handle nil body for JSON binding (#1638) 2018-11-22 09:55:51 +08:00
thinkerou 521d06c81d support bind uri param (#1612)
* support bind uri (1)

* uri binding successful run

* fix vet warning: github.com/gin-gonic/gin/internal.Param composite literal uses unkeyed fields

* fix code style

* update function name

* fix test function signature

* add test for CanSet

* update readme and add test case

* remove internal.Params

* add coverage

* fix warning
2018-11-22 09:29:48 +08:00
thinkerou 7ec82ee894 recovery: fix issue about syscall import on google app engine (#1640)
* recovery: fix issue about syscall import on google app engine

* add ToLower()

* the whole error message
2018-11-22 09:17:44 +08:00
henrylee2cn 3d44ff82a1 Make sure the debug log contains line breaks (#1650)
Many debug logs have no line breaks, so fix them here.

- With pull requests:
  - Open your pull request against `master`
  - Your pull request should have no more than two commits, if not you should squash them.
  - It should pass all tests in the available continuous integrations systems such as TravisCI.
  - You should add/modify tests to cover your proposed code changes.
  - If your pull request contains a new feature, please document it on the README.
2018-11-22 09:07:00 +08:00
Sai d6b2c13b18 Fix typo (#1641) 2018-11-12 18:58:24 +08:00
Justin Israel 37854ee10f Fix panic stack trace being printed during recovery of broken pipe (#1089) (#1259) 2018-11-06 13:40:20 +08:00
Yoshiki Nakagawa 66b47a8068 feat(server): Implements RunFd method (#1609) 2018-11-06 10:28:51 +08:00
Gordon Tyler 8cb390f8fe Yaml binding (#1618)
* Add YAML binding for application/x-yaml.

* Add YAML binding methods to Context.

* Review fixes.

* Revert accidentally removed import.
2018-11-06 09:49:45 +08:00
Barnabus 7a374f9a47 Fix typos (#1626) 2018-11-05 14:17:04 +08:00
Barnabus 4f488aca55 Change the `doctype` to be lowercase to be consistent with the rest of the code base. (#1624) 2018-11-05 09:44:00 +08:00
Barnabus af23ac2256 Remove type attribute from HTML script tag to be consistent with the rest of the codebase. (#1623)
The `<script>` tag is used to define a client-side script (JavaScript).  The "type" attribute is required in HTML 4, but optional in HTML5.
2018-11-05 09:35:24 +08:00
Barnabus f83cdb357e Fix typos (#1625) 2018-11-05 09:13:17 +08:00
chenyang929 b524e29442 Update README.md (#1620)
Missing the right colon
2018-11-01 22:44:49 +08:00
Barnabus 6be9b5437b Change HTML link tags to use HTML5 syntax. (#1621)
The `<link>` element is an empty element, it contains attributes only. In HTML5 the `<link>` tag has no end tag. In XHTML the `<link>` tag must be properly closed.
2018-11-01 21:48:26 +08:00
Barnabus 6f7fe487b3 Change HTML input tags to use HTML5 syntax. (#1617)
In XHTML, the <input> tag must be properly closed, like this `<input />`.  In HTML5 the `<input>` tag has no ending slash.  https://www.w3schools.com/tags/tag_input.asp
2018-11-01 16:05:40 +08:00
root@andrea:~# 8fb21a8bef Added some comments to avoid having golint warnings (#1619)
The following comments to vars, conts and method were added to pass  `golinter` with 100%.

![captura de pantalla 2018-10-31 a la s 15 23 37](https://user-images.githubusercontent.com/10160626/47819725-faba3780-dd20-11e8-978c-1b3ab7de26ed.png)
2018-11-01 15:30:19 +08:00
forging2012 8e9619767c FIX r.LoadHTMLGlob("/path/to/templates") (#1616)
FIX r.LoadHTMLGlob("/path/to/templates")) to r.LoadHTMLGlob("/path/to/templates")
2018-10-31 20:19:58 +08:00
Thomas Schaffer c65e5efc9a Expose HandlerFunc in RouteInfos (#1272) 2018-10-23 10:56:33 +08:00
Ismail Gjevori dbc330b804 Pass MaxMultipartMemory when FormFile is called (#1600)
When `gin.Context.FormFile("...")` is called the `engine.MaxMultipartMemory` is never used. This PR makes sure that the `MaxMultipartMemory` is passed and removes 2 calls to `http.Request.ParseForm` since they are called from `http.Request.ParseMultipartForm`
2018-10-22 23:01:14 +08:00
田欧 a1a32562de
add gin user - photoprism (#1601) 2018-10-19 11:06:23 +08:00
A. F 333bac5f94 add example to set and get cookies (#1599) 2018-10-17 15:40:57 +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
田欧 524757b81c vendor: upgrade some dependency package version (#1596)
ref https://github.com/gin-gonic/gin/pull/1569#issuecomment-429731722
2018-10-15 20:24:32 +08:00
田欧 98082fd590
document: add docs dir and middleware document (#1521)
* init docs dir

* add middleware document

* fix indent

* update docs
2018-10-15 13:01:44 +08:00
田欧 523435e524
attempt to support go module (#1569)
* support go module

* update golint package url

* update golint
2018-10-15 12:52:51 +08:00
Bo-Yi Wu 01ca2530d4 refactor(Makefile): allow overriding default go program (#1593) 2018-10-14 12:39:16 +08:00
Bo-Yi Wu 268e30710b
fix(Makefile): golint to new URL (#1592)
as title. Just update the golint to new URL.
2018-10-14 11:05:24 +08:00
andriikushch 6ab50f944c replace deprecated HeaderMap with Header() (#1585) 2018-10-12 07:31:31 +08:00
zesani fbdcbd2275 Update README.md (#1583)
change "hava" to "have"
2018-10-09 07:14:21 +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
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