1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-24 08:22:21 +02:00
Commit Graph

95 Commits

Author SHA1 Message Date
Pablo Andres Fuente
85e521f384 Fixed panic when Router#Find fails on Param paths
Fixed panic when Router#Find fails to find a route that could match a
Param route that only have children routes and no root route.
e.g
/create
/:id/edit
/:id/active

Finding /creates results in panic because the router tree node that
belongs to the param route :id don't have pnames on it. The childrens of
:id (:id/edit and :id/active) have the pnames properly set, but those
are not processed because /creates don't match on those paths.
2020-10-25 04:14:15 +00:00
Roland Lammel
43e32ba83d
Fix #1526 trailing slash to any route (#1563)
* refs #1526: Add tests for trailing slash requests with nested any routes

* refs #1526: Handle specual router case with trailing slash for non-root any route

* refs #1526: Fix accidential lookup for any route without trailing slash in request
2020-05-06 14:01:28 -07:00
Roland Lammel
5ddc3a68ba
Fix routing conflict for dynamic routes and static route with common prefix (#1509) (#1512)
* Add test for issue #1509 for dynamic routes and multiple static routes with common prefix

* Fix #1509: routing conflict for dynamic routes and static route with common prefix

* Improve routing performance for static only route trees
2020-02-24 08:26:49 -08:00
Roland Lammel
f4b5a90ad3
Fix #1493 router loop for param routes (#1501)
* Add test to reproduce router loop for #1493

* Simplify and correct  router param tests

* Fix #1493 to avoid router loop for param nodes
2020-02-19 07:10:57 -08:00
Ajitem Sahasrabuddhe
5bf6888444 Parameterized routes sometimes return 404 (#1480)
* url param bug

* add comment

* add tests

* Bump echo version
2020-01-23 16:13:18 -08:00
Ajitem Sahasrabuddhe
5793765eed Fix param value bug (#1467)
* set parameter value in the pvalues slice

* update echo version

* update travis yml to fix failing build and add go modules support

* Add tests

* Update router_test.go

Co-authored-by: Vishal Rana <vr@labstack.com>
2020-01-01 08:57:00 -08:00
Roland Lammel
86b200fa0d Merge branch 'bugfix/1412-route-matchany-multilevel' of github.com:neotel-at/echo into bugfix/1412-route-matchany-multilevel 2019-12-27 16:41:31 +01:00
Roland Lammel
ccf6f1a77d refs #1412: Fix parent nodes for route insert on node split 2019-10-16 22:35:30 +02:00
Roland Lammel
8d47b34cdc refs #1412: Fix multi level match any routes 2019-10-16 22:35:30 +02:00
Roland Lammel
16ed3a8049 refs #1412: Fix multi level match any routes 2019-10-03 19:30:46 +02:00
Letian Zhang
8cabd1e123 don't make router parse duplicated param when backtracing happens #1368 (#1369) 2019-07-25 13:39:03 -07:00
Vishal Rana
207a141d5d Closed #1348
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-07-17 21:18:56 -07:00
Michał Adamski
e1d21a73cf tests and fix for findChildByKind executed on nil node 2019-03-01 08:27:11 +01:00
Emir Ribić
c8fd197fa8 Replace http constants with stdlib ones, i.e.: http.MethodGet instead of echo.GET (#1205) 2018-10-14 20:46:58 +05:30
Shogo Nagasaka
af5c97715f Fix node's parameter names assignment problem. (#1201) 2018-10-07 08:34:30 +05:30
Vishal Rana
7c3df7703f Revert "Allow parameter routes to end with a dot (/foo/:id.json)"
This reverts commit bfa14633f3.
2018-04-11 22:34:26 -07:00
Martin Tournoij
bfa14633f3 Allow parameter routes to end with a dot (/foo/:id.json)
Currently a route in the form of `/foo/:id.json` means echo will detect
the parameter name `id.json` instead of the expected `id`. I think this
is rather counter-intuitive, as adding an extension to paths is a fairly
common use case.

With this change both a `/` and a `.` will be treated as the end of a
parameter name.

Benchmark before this change:

	$ go test -bench .
	[..]

	goos: linux
	goarch: amd64
	pkg: github.com/labstack/echo
	BenchmarkRouterStaticRoutes-4             100000             17743 ns/op               0 B/op          0 allocs/op
	BenchmarkRouterGitHubAPI-4                 50000             33081 ns/op               1 B/op          0 allocs/op
	BenchmarkRouterParseAPI-4                 300000              5370 ns/op               0 B/op          0 allocs/op
	BenchmarkRouterGooglePlusAPI-4            200000              9183 ns/op               0 B/op          0 allocs/op
	PASS
	ok      github.com/labstack/echo        8.565s

After this change:

	goos: linux
	goarch: amd64
	pkg: github.com/labstack/echo
	BenchmarkRouterStaticRoutes-4             100000             17699 ns/op               0 B/op          0 allocs/op
	BenchmarkRouterGitHubAPI-4                 50000             32962 ns/op               1 B/op          0 allocs/op
	BenchmarkRouterParseAPI-4                 300000              5450 ns/op               0 B/op          0 allocs/op
	BenchmarkRouterGooglePlusAPI-4            200000              9205 ns/op               0 B/op          0 allocs/op
	PASS
	ok      github.com/labstack/echo        8.590s

Fixes #599
2018-04-10 11:37:35 -07:00
Vishal Rana
687f05470a Zhaojkun httperror message (#959)
* Change echo http error message

* Add test case

* Fixed test cases

Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-20 08:58:53 -07:00
Vishal Rana
1b70cbebbe Fixed #954
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-14 16:30:53 -07:00
Vishal Rana
f9e97332f3 fixed #729
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-15 20:12:13 -08:00
Vishal Rana
c5a3575d4c updated migration guide
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-14 22:54:09 -08:00
Vishal Rana
0fca54f389 updated docs, readme and benchmark tests
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-12 09:47:49 -08:00
Vishal Rana
954efac63a fixed #684
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-22 15:18:55 -07:00
Vishal Rana
36251e88e2 router changes
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-21 20:36:49 -07:00
Vishal Rana
2bdbf6918e fixed #623
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-14 14:52:40 -07:00
Vishal Rana
2eb87f8036 param wildcard capture fixed to *
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-10 18:36:48 -07:00
Vishal Rana
8623669cbc removed Context#P()
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-10 18:22:13 -07:00
Vishal Rana
15eb5b0aad removed embedded context and exposed SetRequest in context
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-10 17:31:26 -07:00
Vishal Rana
09a2ce60a6 About context #500
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-05 13:47:59 -07:00
Vishal Rana
682a5580b7 Deprecated Echo#GetContext() => Echo#AcquireContext(), Echo#PutContext() => Echo#ReleaseContext()
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-05-03 17:23:31 -07:00
Vishal Rana
467cf05b41 Changes based on comments for #430
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-16 15:56:09 -07:00
Vishal Rana
33700bfcc2 Fixed #457
- Dropped static middleware in favor of Echo#Static & Echo#StaticConfig.
- Enhanced middleware chaining.

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-09 14:00:23 -07:00
Vishal Rana
b5d6c05101 Fixed #441, #294
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-02 14:24:51 -07:00
Vishal Rana
7cf31b3b68 dummy
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-18 08:47:03 -07:00
Vishal Rana
3946a1839c New API Echo#GetContext & Echo#PutContext.
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-17 21:49:06 -07:00
Vishal Rana
09f3d3061f Closes #314
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-11 07:53:54 -08:00
Vishal Rana
4f08fed018 Fixed #378
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-06 23:24:51 -08:00
Vishal Rana
d5ba76ed81 Router fix, #217, #371, #372.
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-03 22:06:47 -08:00
Vishal Rana
51acf465fe - Moved static file serving to a new handler package
- Middleware at route level
- Group middleware is a in closure now

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-15 08:11:29 -08:00
Vishal Rana
0731959a98 Object method to get real object
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-08 16:48:03 -08:00
Vishal Rana
f405794a7c Now using sync.Pool
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-04 14:40:08 -08:00
Vishal Rana
dbd1e8e230 Separated recipes from the main repo
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-01-09 11:00:13 -08:00
Vishal Rana
0884290766 Added X() method to return context
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-04 08:13:26 -08:00
Vishal Rana
72459fe299 Step towards v2
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-03 17:23:53 -08:00
Vishal Rana
51f118b0ee Refactored variable type to kind
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-10-07 15:10:40 -07:00
Vishal Rana
5b019c507e Handling 405 & pre-flight requests
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-10-06 06:48:33 -07:00
Vishal Rana
c9a581815a Fixed #210
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-09-17 08:18:58 -07:00
Vishal Rana
853e650ee2 Fixed #207
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-09-16 19:37:37 -07:00
Vishal Rana
f251eead67 Fixed #184
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-09-15 08:29:29 -07:00
Vishal Rana
d077efe91a Fixed #162
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-07-27 08:43:11 -07:00