Commit Graph

51 Commits

Author SHA1 Message Date
Georgi Dimitrov
386d244068
fix(tree): correctly expand the capacity of params (#3502) 2023-12-07 08:38:55 +08:00
t0rchwo0d
4cee78f538
Fix #3500 Add escape logic for header (#3503) 2023-02-19 21:25:48 +08:00
t0rchwo0d
81ac7d55a0
Add escape logic for header (#3500) 2023-02-17 10:00:19 +08:00
Kristian Svalland
8eb5f832ba
fix(router): tree bug where loop index is not decremented. (#3460)
fixes https://github.com/gin-gonic/gin/issues/3459
2023-01-07 08:57:54 +08:00
Qt
6150c488e7
remove deprecated of package io/ioutil (#3395) 2022-11-17 22:35:55 +08:00
thinkerou
4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
thinkerou
fcd36c549d
fix: test error (#3087) 2022-03-18 11:55:25 +08:00
thinkgo
417b142703
feat: add StaticFileFS (#2749)
* RouterGroup.StaticFileFS added
add StaticFileFS ad README

* fix Static content mistake

* update README `tab`
improve StaticFile and StaticFileFS code, use staticFileHandler
2022-03-18 09:52:23 +08:00
Bo-Yi Wu
94153d1e19
test: expose performRequest func (#3012) 2022-01-02 19:07:44 +08:00
市民233
1c2aa59b20
fix the misplacement of adding slashes (#2847) 2021-10-26 18:15:29 +08:00
thinkerou
77649bcfee
support Go v1.16 version (#2638) 2021-04-21 07:38:54 +08:00
Ni Hao
a331dc6a31
chore: remove duplicate test 'assert.Equal' (#2617)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-03-27 14:41:31 +08:00
vinhha96
a6e8665e42
fix(tree): reassign fullpath when register new node which the same current node (#2366)
* fix(tree): assign fullpath to current node by fullpath of new node if current node the same new node

* test(router-test): reverse the order when register router when test func GetFullPath

* chg(tree-test): update test case with register new route in TestRouteContextHoldsFullPath

Co-authored-by: vinhha <vinhha@vng.com.vn>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-05-11 13:25:49 +08:00
thinkerou
6ac7f194c4
chore: update some code style (#2356) 2020-05-05 13:55:57 +08:00
thinkerou
d5f12ac6d7
use http method constant (#2155)
* use http method constant

* fix typo
2019-11-29 07:50:49 +08:00
Bo-Yi Wu
352d69c71f
chore(performance): Improve performance for adding RemoveExtraS… (#2159)
* chore: Add RemoveExtraSlash flag

* fix testing

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2019-11-29 00:02:02 +08:00
bbiao
f65018d7b1 Bugfix for the FullPath feature (#1919)
* worked with more complex situations
 * the original pr not work when and a short route with the same prefix
 to some already added routes
2019-06-28 23:54:52 +08:00
Roman Zaynetdinov
35e33d3638 Hold matched route full path in the Context (#1826)
* Return nodeValue from getValue method

* Hold route full path in the Context

* Add small example
2019-05-26 08:20:21 +08:00
Dan Markham
b6425689dc Clean the Request Path early (#1817)
This will reduce the number of times we have todo a redirect.
and allow multiple slashes in path to be routed!
fixes #1644
2019-05-07 19:32:35 +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
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
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
MetalBreaker
b97ccf3a43 Router: Route StaticFS() not found to Router's NoRoute() (#1663)
Closes #1220
2018-11-26 23:01:51 +08:00
andriikushch
6ab50f944c replace deprecated HeaderMap with Header() (#1585) 2018-10-12 07:31:31 +08:00
田欧
f45c928a15 chore: use http.Status* instead of hard code (#1482) 2018-08-14 09:51:56 +08:00
田欧
e5bb4f62a2 chore: add return or remove else for reduce indent (#1470) 2018-08-12 21:17:57 +08:00
田欧
eeb57848ca update assert param(expect, actual) position (#1177) 2017-11-21 21:18:45 +08:00
Eason Lin
4b5ec517da fix(test): only check Location header (#1064)
* fix(test): only check Location header

* fix(test): rename field

* fix(test): not export field
2017-08-14 11:02:31 +08:00
Eason Lin
436d8e2af9 Improve serveError code coverage (#980) 2017-07-05 20:30:09 -05:00
Sergey Egorov
b1872ec369 The url.RawPath used when engine.UseRawPath is set to true. (#810) 2017-02-28 18:29:41 +08:00
Manu Mtz-Almeida
d4dec77afa Adds unit tests for RedirectTrailingSlash & RedirectFixedPath 2015-07-04 14:13:25 +02:00
Manu Mtz-Almeida
95c08d5f84 Adds HandlerName() 2015-06-25 19:44:52 +02:00
Manu Mtz-Almeida
0b043d0886 Fixes performance regression 2015-06-04 01:54:36 +02:00
Manu Mtz-Almeida
0d5dc25d39 Fixes unit test when running in Windows 2015-05-31 18:44:34 +02:00
Manu Mtz-Almeida
835f66fdc9 404 not found performance improvements
benchmark            old ns/op     new ns/op     delta
Benchmark404         737           249           -66.21%
Benchmark404Many     2330          454           -80.52%

benchmark            old allocs     new allocs     delta
Benchmark404         3              0              -100.00%
Benchmark404Many     10             0              -100.00%

benchmark            old bytes     new bytes     delta
Benchmark404         115           68            -40.87%
Benchmark404Many     235           57            -75.74%
2015-05-30 14:45:13 +02:00
Manu Mtz-Almeida
54a86280f9 Testing more use cases. 2015-05-26 17:49:25 +02: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
98951c44aa Return 404 when listing empty directory 2015-05-24 17:03:44 +02:00
Manu Mtz-Almeida
fcfe65685a Refactored StaticFS()
- different approach to disable directory listing.
2015-05-24 16:29:55 +02:00
Manu Mtz-Almeida
cac77e04e3 Adds option for listing directory files + better unit tests 2015-05-21 17:01:13 +02:00
Manu Mtz-Almeida
022304e7d9 Better API for RouteGroup.Handle() 2015-05-19 23:22:35 +02:00
Manu Mtz-Almeida
53329e4646 Testing new Any routing. 2015-05-19 23:00:55 +02:00
Manu Mtz-Almeida
afb32ac6ac Adds new unit test: static + middleware 2015-05-18 20:51:08 +02:00
Manu Mtz-Almeida
9ecb76ef6e Cosmetic changes 2015-05-18 20:50:46 +02:00
Manu Mtz-Almeida
eb3e9293ed Renames []HandleFunc to HandlersChain 2015-05-07 11:30:01 +02:00
Manu Mtz-Almeida
f212ae7728 Updates tree.go + fixes + unit tests 2015-05-05 16:37:33 +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
4d315f474b More unit tests 2015-04-08 14:24:49 +02:00