1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-28 08:38:39 +02:00
Commit Graph

1387 Commits

Author SHA1 Message Date
J. David Lowe
8d7f05e533 round-trip paramValues without exploding (#1463) 2020-01-23 18:32:17 -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
Eugene
399da56370 Improve bind performance (#1469)
* Improve bind performance

By some slight optimisations and lesser reflect usage now binding has significantly better performance:

name                    old time/op    new time/op    delta
BindbindData-8            21.2µs ± 2%    13.5µs ± 2%  -36.66%  (p=0.000 n=16+18)
BindbindDataWithTags-8    22.1µs ± 1%    16.4µs ± 2%  -26.03%  (p=0.000 n=20+20)

name                    old alloc/op   new alloc/op   delta
BindbindData-8            2.40kB ± 0%    1.33kB ± 0%  -44.64%  (p=0.000 n=20+20)
BindbindDataWithTags-8    2.31kB ± 0%    1.54kB ± 0%  -33.19%  (p=0.000 n=20+20)

name                    old allocs/op  new allocs/op  delta
BindbindData-8               297 ± 0%       122 ± 0%  -58.92%  (p=0.000 n=20+20)
BindbindDataWithTags-8       267 ± 0%       125 ± 0%  -53.18%  (p=0.000 n=20+20)

* Remove creation of new value in unmarshalFieldNonPtr
2020-01-08 13:40:52 -08:00
Roland Lammel
94d9e009d8 Tidy up unused imports from go.mod (#1468) 2020-01-08 10:53:02 -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
Vishal Rana
07ec791103 Updated deps
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-12-29 23:08:27 -08:00
Vishal Rana
a64188c609 Merge branch 'neotel-at-bugfix/1412-route-matchany-multilevel' 2019-12-29 23:07:38 -08:00
Vishal Rana
8f69b47891 Merge branch 'bugfix/1412-route-matchany-multilevel' of https://github.com/neotel-at/echo into neotel-at-bugfix/1412-route-matchany-multilevel 2019-12-29 23:06:59 -08:00
Roland Lammel
8bfed69571 Run go mod tidy 2019-12-27 16:43:06 +01: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
Alex Besogonov
5c7c87d09e Add ability to set the logger on echo.Context (#1377)
This change allows middleware to replace the logger on the echo.Context
with a customized per-request logger with additional fields. The logger
is reset to default on every Reset() call.
2019-11-11 12:34:13 -08:00
Vishal Rana
c50c67783f Fixed #1426
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-10-30 19:01:23 -07:00
Shin Ohno
8b7220f97c Fixed comment typo in BodyDump (#1431) 2019-10-30 17:34:27 -07:00
Vishal Rana
7c5e9ab0d9 Fixed #988
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-10-24 14:59:52 -07:00
Argishti Rostamian
754b44989f Close file descriptor returned by request.FormFile (#1411) 2019-10-24 11:52:14 -07:00
Mark Smith
ee6618e831 reset p.values to echo.maxParam (#1429)
* reset p.values to echo.maxParam
* Update context.go

How about just reset the values?
2019-10-24 10:48:56 -07: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
616db6dbad Add unrelated route to group test with match any 2019-10-16 22:35:30 +02:00
Roland Lammel
59a25f13bb Add tests for group routing with middleware and match any routes 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
Vishal Rana
d286e285dc Bumped v4.1.11
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-10-06 17:01:28 -07:00
Vishal Rana
05262e484a Capture proxy middleware error
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-10-06 16:56:21 -07:00
Roland Lammel
7738dd3a44 Add unrelated route to group test with match any 2019-10-04 19:58:52 +02:00
Roland Lammel
2bc8d10b21 Add tests for group routing with middleware and match any routes 2019-10-04 01:15:54 +02:00
Roland Lammel
16ed3a8049 refs #1412: Fix multi level match any routes 2019-10-03 19:30:46 +02:00
Bob Hall
b129098169 dont return 400 for empty bodies (#1410)
* dont return 400 for empty bodies

* remove test for missing contentlength 0
2019-09-30 10:56:32 -07:00
Vishal Rana
81a66086ae
Update ISSUE_TEMPLATE.md 2019-08-23 09:02:25 -07:00
Vishal Rana
88a9ad73ec Updated dep & bumped v4.1.10
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-08-17 07:39:36 -07:00
Vishal Rana
350ccd2452 Bumped vv4.1.9
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-08-11 12:55:02 -07:00
Vishal Rana
2b0cfbe75d Merge branch 'master' of https://github.com/labstack/echo 2019-08-11 12:48:52 -07:00
Vishal Rana
ecc01d2051 Include internal error in http error handler
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-08-11 12:48:50 -07:00
Jesse Szwedko
608cebbaae Assign new ResponseWriter after calling http.HandlerFunc (#1341)
Otherwise, the `http.ResponseWriter` passed to `next()` within the
middleware is unused. This precludes middlewares from wrapping the
http.ResponseWriter to do things like record the status code.
2019-08-07 11:10:18 -07:00
Vishal Rana
09d415cefc Fixed version
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-08-04 21:47:41 -07:00
Vishal Rana
ed51400a81 Enhanced default http error handler
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-08-01 22:52:42 -07:00
Hylke Visser
87da9a948b Add ReferrerPolicy to Secure middleware (#1363) 2019-08-01 15:27:09 -07:00
Letian Zhang
8cabd1e123 don't make router parse duplicated param when backtracing happens #1368 (#1369) 2019-07-25 13:39:03 -07:00
nattawitc
8cfaf50b8f fix #1260 change middleware.Logger's default output (#1336)
* fix TestLoggerIPAddress reverse assertion

* change middleware.Logger default output

* remove nil field declaration
2019-07-17 21:34:31 -07:00
Vishal Rana
405b221ad4 Merge branch 'meehow-master' 2019-07-17 21:19:09 -07:00
Vishal Rana
207a141d5d Closed #1348
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-07-17 21:18:56 -07:00
Vishal Rana
ae55310e59 Merge branch 'master' of https://github.com/meehow/echo into meehow-master 2019-07-17 18:31:55 -07:00
Vishal Rana
9bf857f14c Nil check for bind #988
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-07-14 22:39:07 -07:00
Vishal Rana
da45981491 Fixed #988
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-07-14 21:35:59 -07:00
Nipe Setiawan
01229ec651 fix version string to 4.1.6 (#1358) 2019-07-01 09:58:23 -07:00
Vishal Rana
8fb7b5be27 Closes #1353
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-06-27 10:52:17 -07:00
kolaente
858270f6f5 Added feature to map url params to a struct with the default binder (#1165)
* Added feature to map url params to a struct with the default binder

* Added test for mix of POST data and bound params

* Renamed variables

* Added error check

* Removed unneded fix
2019-06-21 06:12:55 -07:00
Tom Scholz
31361576e8 feat: Add a new ErrorHandlerWithContext (#1328)
* feat: Add a new ErrorHandlerWithContext

This commit adds a new error handler, which is passed the 
current context, so that you can add custom redirects or even
other kinds of responses. For example:

```go
	e.Use(middleware.JWTWithConfig(middleware.JWTConfig{
		SigningKey: []byte("secret"),
		TokenLookup: "query:token",
		ErrorHandlerWithContext: func(err error, c echo.Context) error {
			// do stuff with context and err
			switch err.(type) {
			case jwt.ValidationError:
				return c.Redirect(http.StatusSeeOther, "/login")
			}
			return err
		},
	}))
```

* chore: address golint issues
2019-06-13 13:21:03 -07:00
ozburo
6b9408d1d1 Added param:<name> lookup option to JWT Middleware (#1296)
* Added  lookup option to JWT Middleware

* Added param:<name> lookup option to JWT Middleware
2019-06-09 09:49:52 -07:00
Garrett D'Amore
c824b8ddc3 Add support for encoding.TextUnmarshaler in bind. (#1314) 2019-06-09 09:39:54 -07:00
Vishal Rana
842fc8772f Fixed #1323
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-06-09 09:37:21 -07:00
kolaente
610d67f17f Added support for the REPORT method (#1332) 2019-06-09 09:11:18 -07:00