1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-24 20:14:31 +02:00
Commit Graph

1450 Commits

Author SHA1 Message Date
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
Carlos Eduardo
530f768a47 Update x/sys module to support Risc-V (#1344) 2019-06-08 09:46:39 -07:00
Noam Y. Tenne
fbb72869b3 Fix for #1334 (#1335)
* echo.context.cjson should encode the JSON before writing the status code #1334 :

`response.Write` automatically sets status to `200` if a response code wasn't committed yet. This is convenient, but it ignores the fact that `response.Status` is a public field that may be set separately/before `response.Write` has been called
A `response.Status` is by default `0`, or `200` if the response was reset, so `response.Write` should fallback to `200` only if a code wasn't set yet.

* echo.context.cjson should encode the JSON before writing the status code #1334 :

Writing the response code before encoding the payload is prone to error.
If JSON encoding fails, the response code is already committed, the server is able to only modify the response body to reflect the error and the user receives an awkward response where the status is successful but the body reports an error.
Instead - set the desired code on `c.response.Status`. If writing eventually takes place, the desired code is committed. If an error occurs, the server can still change the response.
2019-05-23 22:13:57 -07:00
Das Jott
e2671fe963 Provide possibility to use key ids (#1289)
* provide possibility to use key ids
* kid tests
2019-05-17 07:45:49 -07:00
Jonathan Bouchard
b1bc80528b Fixed indentation in code example. (#1338) 2019-05-14 10:17:08 -07:00
Vishal Rana
5d2c33ad5d Bumped v4.1.5
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-29 22:54:49 -07:00
Vishal Rana
64c6d92295 Fixed group middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-29 16:46:08 -07:00
Vishal Rana
f27e87f36e Fixed golint error
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-29 13:53:12 -07:00
Vishal Rana
4de244c072 Fixed invalid json value for error in logger middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-29 13:21:11 -07:00
Vishal Rana
8c13b9dae2 Fixed sub-group virtual hosts 2019-04-28 23:10:00 -07:00
Vishal Rana
46ae04bef2 Added a method to return routers map
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-28 22:49:18 -07:00
Vishal Rana
c8e923cf54 Bumped 4.1.0
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-28 22:25:45 -07:00
Vishal Rana
6f0a227a5a Built-in capability to run multiple hosts
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-28 22:22:35 -07:00
Vishal Rana
e53d9c516f Updated deps and fixed a typo
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-04-27 22:32:29 -07:00
Hylke Visser
69bd47b35f Fix flushing in Gzip middleware (#1317)
* Make Gzip response Writer also call Flush of underlying Writer
* Add unit test for chunked responses with Gzip
2019-04-16 15:52:06 -05:00
Andrew Braunstein
e3717be4be ensure that the TLS conifg contains the ALPN protocol (#1305) 2019-03-12 17:54:16 -07:00
atsushi-ishibashi
1f6cc362cc Set subdomains to AllowOrigins with wildcard (#1301)
* Set subdomains to AllowOrigins with wildcard

* Create IsSubDomain

* Avoid panic when pattern length smaller than domain length

* Change names, improve formula
2019-03-09 10:32:49 -08:00
Helen Hood
5434a5392f Enable adding preload tag to HSTS header (#1247) 2019-03-06 10:22:19 -08:00
Hemachandar
08db4bd39b simplify middleware chain creation (#1299) 2019-03-05 08:24:59 -08:00
Hemachandar
775b2eefec Refactor DefaultProxyConfig Skipper & WebSocket Check in Context (#1297)
* refactor: default to DefaultProxyConfig.Skipper if not provided

* refactor: use strings library for websocket check
2019-03-02 10:43:23 -08:00
Michał Adamski
e1d21a73cf tests and fix for findChildByKind executed on nil node 2019-03-01 08:27:11 +01:00
Kumar Harsh
802fb5bba6 feat(secure): support Content-Security-Policy-Report-Only header (#1287)
Closes #1283
2019-02-26 22:32:07 -08:00
Evgeniy Kulikov
17b5044459 Add go 1.12 to TravisCI (#1294) 2019-02-26 10:15:24 -08:00
Andrei Avram
be919e8f16 Increase Context tests coverage (#1279)
* Test context path.

* Test context handler.

* Test handler error.

* Text context validate.

* Test context query string.

* Test context undefined param.

* Test context request.

* Test context scheme.

* Test context is websocket.

* Test context multipart form params with error.

* Text context bind.

* Text context logger.

* Text context xml response write error.

* Test context real ip.
2019-02-19 10:18:42 -08:00
Ronald Bell
5aec1b234f www redirects are too broad (#1274) 2019-02-15 09:56:58 -08:00
Mohamed Bana
8716acb0ab Echo.StartTLS: accept string or []byte as parameters. (#1277)
If `certFile` or `keyFile` is `string` the values are treated as file paths.
If `certFile` or `keyFile` is `[]byte` the values are treated as the certificate or key as-is.
2019-02-15 09:51:54 -08:00
Andrei Avram
3d73323154 Use concurrency safe context by default. (#1158) 2019-02-12 10:56:26 -08:00
Evgeniy Kulikov
88965757af Simplify code of Add/Remove trailing slash and fix bug (#1275)
* Simplify code of Add/Remove trailing slash

- simplify code (more informative / understanding)
- assert collides with imported package name (in tests)
- fix unhandled errors

* add tests for https://github.com/labstack/echo/pull/1275#issuecomment-460467700
2019-02-07 09:49:51 -08:00
Evgeniy Kulikov
bc28fceaf3 Fix unhandled errors (#1271) 2019-02-01 06:33:56 -08:00
Alex Ungur
6d9e043284 Introduced Go module support as v4, removed obsolete CloseNotifier() mechanism
This reintroduces support for Go modules, as v4.

CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http

It was already NOT working (not sending signals) as of 1.11 the functionality was gone, we merely
deleted the functions that exposed it. If anyone still relies on it they should migrate to using
`c.Request().Context().Done()` instead.

Closes #1268, #1255
2019-01-30 16:11:42 +02:00
Evgeniy Kulikov
282a44d4ad Remove unreachable code (#1254)
`if` <-> `else if` <-> `else` has `return` and after `else` was `return`
2019-01-28 07:59:36 -08:00
Alex Ungur
0b714f3482 Bumped up the version 2019-01-28 17:43:48 +02:00
Alex Ungur
38772c686c Removed go.mod and sum to help solve the issue with Go modules (#1244) 2019-01-28 16:12:53 +02:00
Alex Ungur
afe90e79d9 Bumped up version to include -dev 2019-01-27 00:44:28 +02:00
Alex Ungur
739700bf4e Bumped up version to 3.3.9 (related to #1244) 2019-01-27 00:39:45 +02:00
Vishal Rana
7867fce6ce Changes related to #1199
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-01-14 10:56:17 -08:00
Evgeniy Kulikov
62145fad3e [extend #1191] Unnecessary alloc for XML, JSON, JSONP (#1199)
* [extend #1191] Unnecessary alloc for XML, JSON, JSONP

* add legacy (JSON/JSONP/XML)Blob tests

* fix namings

* fix `jsonPBlob` allocs

* fix review comments (thx @alexaandru)

* fix review comments (thx @alexaandru)
add benchmarks
2019-01-14 10:12:22 -08:00
Shu Kutsuzawa
e6ac0023d2 Add golint to ci (#1243)
* add golint to travis ci

* fixed based on golint

* Update echo.go
2019-01-09 15:19:48 -08:00