1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-20 19:52:47 +02:00
Commit Graph

1681 Commits

Author SHA1 Message Date
Bertram Truong
1ae109c688 Expose stdLogger (#1196) 2018-09-28 10:09:35 -07:00
Emir Ribić
a2d4cb9c7a Simplify REALIP method (#1193)
* Simplify REALIP method

* Remove alloc
2018-09-19 10:18:50 -07:00
Evgeniy Kulikov
c185ebd0de Update dependencies (#1194)
* Update go.mod

Replace:
`github.com/labstack/gommon v0.0.0-20180312174116-6fe1405d73ec`
With:
`github.com/labstack/gommon v0.2.7`

* Update Gopkg

Replace:
`github.com/labstack/gommon 0.2.4`
With:
`github.com/labstack/gommon v0.2.7`

* Update go/dep 0.5.0
2018-09-14 07:46:40 -07:00
Emir Ribić
688ab2bec6 Remove unecessery if-s and else-s (#1189) 2018-09-07 07:58:04 -07:00
Geon Kim
54d5613aa2 Add go.mod for Go modules (#1187)
* Add go.mod
* Resolve problem
2018-09-04 08:07:41 -07:00
Vishal Rana
90822319eb Fixed test
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-08-28 20:49:22 -07:00
takaya kusanagi
31e795315a change getting method point after overriding method in premiddleware (#1182) 2018-08-28 18:50:58 -07:00
Geon Kim
b369096cac echo: use HTTP status codes constants where applicable (#1184) 2018-08-28 18:40:40 -07:00
Bo-Yi Wu
65f7897b7a Add go 1.11.x version (#1186) 2018-08-28 08:03:34 -07:00
Marcin Węglarz
74f9806b34 Fix issue #1143 (#1176) 2018-08-15 07:35:27 -07:00
Andrei Serban
2017e5e541 logs the internal error message instead of returning it (#1173) 2018-08-02 14:11:20 -07:00
Philipp Gillé
76d8adbf2d Fix typo 2018-07-29 14:00:49 -07:00
Vishal Rana
db8f5706fd Closed #1121
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-07-17 23:21:54 -07:00
Kesus Kim
09dcba1d39 rename proto to protocol 2018-07-10 23:06:17 -07:00
Kesus Kim
2a5460328f add test case for logger middleware 2018-07-10 23:06:17 -07:00
Kesus Kim
146100093e add proto field for middleware 2018-07-10 23:06:17 -07:00
Vishal Rana
d8a6dad02d [JWT] use local error handler for missing token
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-07-09 11:36:25 -07:00
Brandon Hansen
6007218835 case sensitive matching prioritized 2018-07-03 13:04:50 -07:00
Brandon Hansen
01cfe83efe Enable case insensitive query param matching
Unmarshalling body params with json.Unmarshal supports case-insensitive
matching against struct tags.  Matching query params case insensitive
provides a more sane and consistent experience for API consumers.

The original url.Values keys remain case sensitive.
2018-07-03 13:04:50 -07:00
Vishal Rana
ec7b497940 Fixed cors test
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-07-03 09:51:15 -07:00
Jean-Sébastien Ney
8203e48696 add a few tests 2018-07-03 09:45:12 -07:00
Jean-Sébastien Ney
d63824fa41 handle using withcredentials and allow origin * together 2018-07-03 09:45:12 -07:00
Vishal Rana
9b4cc60ce2 Added error to logger middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-06-28 21:22:50 -07:00
Vishal Rana
61084e242e JWT BeforeFunc, SuccessHandler & ErrorHandler
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-06-28 20:42:18 -07:00
Jeffrey Reuling (TI)
56091a4186 allow whitespace in regex 2018-06-26 09:57:59 -07:00
chanxuehong
5ac8bedce8 rm unused code 2018-06-22 07:49:53 -07:00
AnuchitO
d36ff72961 Add field name in Error message when Binding type mismatch
Old error message
`
Unmarshal type error: expected=int, got=string, offset=47
`
New error message
`
Unmarshal type error: expected=int, got=string, field=age, offset=47
`
Make it easy to fix for client.
2018-05-01 06:51:22 -07:00
Vishal Rana
f867058e3b Update echo.go 2018-04-16 10:20:39 -07:00
roxma
6016350b4c Allow using middleware with echo.File 2018-04-16 10:20:39 -07:00
Vishal Rana
b64e4d12c7 Removed error log from http error handler
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-04-15 14:00:04 -07:00
Vishal Rana
ce4a31c74d Update README.md 2018-04-14 17:14:43 -07:00
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
Vishal Rana
28d07c3bca Revert "Fix parameter routes with an extension (/foo/:id.json)"
This reverts commit cf7b55584d.
2018-04-11 22:34:26 -07:00
Vishal Rana
a8aaeb8a26 Revert "Revert "Fix parameter routes with an extension (/foo/:id.json)""
This reverts commit f526774740.
2018-04-11 22:34:26 -07:00
Vishal Rana
f526774740 Revert "Fix parameter routes with an extension (/foo/:id.json)"
This reverts commit cf7b55584d.
2018-04-11 22:32:19 -07:00
Vishal Rana
38f27e229c Enhanced static browse
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-04-11 21:41:18 -07:00
Vishal Rana
88a865e8a2 Changed version for master branch
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-04-11 11:52:24 -07:00
Martin Tournoij
cf7b55584d Fix parameter routes with an extension (/foo/:id.json)
This is a follow-up to #1101. It turns out that that patch is
incomplete, as a similar check also needs to be added in the
`Router.Add()` method.

I don't understand why the test works fine, but when using it in a real
application. For example with this example:

	func main() {
		e := echo.New()
		e.GET("/xxx/:id.json", func(c echo.Context) error {
			return c.String(200, fmt.Sprintf("%#v: names: %#v; vals: %#v",
				c.Path(), c.ParamNames(), c.ParamValues()))
		})
		log.Fatal(e.Start(":8000"))
	}

Gives a 404 on `/xxx/42.json`, and for `/xxx/42` it gives the output:

	/xxx/:id.json": names: []string{"id.json"}; vals: []string{"42"}

It makes sense to add the test there too; I just don't get why the test
cases that I added in ##1101 *does* produce the correct output :-/
2018-04-10 14:54:01 -07:00
Vishal Rana
5b769f91b2 HTTPError#Inner to HTTPError#Internal
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-04-10 12:06:31 -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
Alexandre Stein
37f1a470ef Replace the redirection with a direct call to url package 2018-04-03 08:40:03 -07:00
Alexandre Stein
af1bfd5397 Clean old Go versions 2018-04-03 08:40:03 -07:00
Andrew Wilkins
60f88a7a1c Export version
I'm looking into implementing tracing middleware for Echo
(https://github.com/elastic/apm-agent-go/issues/20). I'd
like to report the version of the Echo framework in use.
2018-03-21 21:42:26 -07:00
Vishal Rana
a5d81b8d4a Updated deps, removed json-iterator, fixed #1087, fixed #1086
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-03-16 10:00:59 -07:00
Florian Holzapfel
9aafcaf934 fix: BodyLimit middleware: limitedReader Reset does not reset read counter 2018-03-16 09:48:23 -07:00
Jeffrey Reuling (TI)
ee32e3e7fb fix issue #1086 2018-03-16 09:47:05 -07:00
Vishal Rana
d79727cf89
Update README.md 2018-03-15 07:01:18 -07:00
Vishal Rana
d9da3f1f6e
Update README.md 2018-03-15 00:59:32 -07:00
Vishal Rana
dc5cb1343b
Update README.md 2018-03-15 00:56:47 -07:00
Vishal Rana
2f9a8e148f
Update README.md 2018-03-15 00:54:56 -07:00