From 5c9b3fa52cac69316969cabc4c380d90ab7e89a6 Mon Sep 17 00:00:00 2001 From: Eason Lin Date: Wed, 28 Jun 2017 00:18:33 +0800 Subject: [PATCH 1/7] =?UTF-8?q?Unify=20=E2=80=98github.com=E2=80=99=20word?= =?UTF-8?q?ing=20with=20code.=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a8ac70..5153bb6 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,13 @@ Gin middleware/handler to enable CORS support. Download and install it: ```sh -$ go get gopkg.in/gin-contrib/cors.v1 +$ go get github.com/gin-contrib/cors ``` Import it in your code: ```go -import "gopkg.in/gin-contrib/cors.v1" +import "github.com/gin-contrib/cors" ``` ### Canonical example: @@ -32,7 +32,7 @@ package main import ( "time" - "gopkg.in/gin-contrib/cors.v1" + "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" ) From 796e03648c42171f8313388c306e6b1a2bc0e0af Mon Sep 17 00:00:00 2001 From: Eason Lin Date: Wed, 28 Jun 2017 08:45:17 +0800 Subject: [PATCH 2/7] Remove unnecessary comments. --- cors.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cors.go b/cors.go index 16550f4..c2ea94a 100644 --- a/cors.go +++ b/cors.go @@ -13,8 +13,6 @@ type Config struct { AllowAllOrigins bool // AllowedOrigins is a list of origins a cross-domain request can be executed from. - // If the special "*" value is present in the list, all origins will be allowed. - // Default value is ["*"] AllowOrigins []string // AllowOriginFunc is a custom function to validate the origin. It take the origin @@ -28,8 +26,6 @@ type Config struct { // AllowedHeaders is list of non simple headers the client is allowed to use with // cross-domain requests. - // If the special "*" value is present in the list, all headers will be allowed. - // Default value is [] but "Origin" is always appended to the list. AllowHeaders []string // AllowCredentials indicates whether the request can include user credentials like From f894742c196d528a81bd99556ba819bd06d71a4e Mon Sep 17 00:00:00 2001 From: Matthew Baird Date: Tue, 27 Jun 2017 21:27:08 -0700 Subject: [PATCH 3/7] add support for wildcard cors origin (#24) --- cors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cors.go b/cors.go index 16550f4..d5b912a 100644 --- a/cors.go +++ b/cors.go @@ -69,8 +69,8 @@ func (c Config) Validate() error { return errors.New("conflict settings: all origins disabled") } for _, origin := range c.AllowOrigins { - if !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") { - return errors.New("bad origin: origins must include http:// or https://") + if origin != "*" && !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") { + return errors.New("bad origin: origins must either be '*' or include http:// or https://") } } return nil From 12389742741664c92da0c3a941bdf9932b7670bc Mon Sep 17 00:00:00 2001 From: Eason Lin Date: Wed, 28 Jun 2017 13:58:35 +0800 Subject: [PATCH 4/7] =?UTF-8?q?Change=20comments=20to=20=E2=80=98Default?= =?UTF-8?q?=20value=20is=20[]=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cors.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cors.go b/cors.go index c2ea94a..6284302 100644 --- a/cors.go +++ b/cors.go @@ -13,6 +13,7 @@ type Config struct { AllowAllOrigins bool // AllowedOrigins is a list of origins a cross-domain request can be executed from. + // Default value is [] AllowOrigins []string // AllowOriginFunc is a custom function to validate the origin. It take the origin From e641d4ab82010a260e186dcc4237cb693fd49653 Mon Sep 17 00:00:00 2001 From: Eason Lin Date: Mon, 3 Jul 2017 00:16:58 +0800 Subject: [PATCH 5/7] undo comments, cross support for wildcard origin --- cors.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cors.go b/cors.go index 6284302..9cd1a2c 100644 --- a/cors.go +++ b/cors.go @@ -13,6 +13,7 @@ type Config struct { AllowAllOrigins bool // AllowedOrigins is a list of origins a cross-domain request can be executed from. + // If the special "*" value is present in the list, all origins will be allowed. // Default value is [] AllowOrigins []string From 88488351b0df049b2d3d65cab583c6bed894abb2 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 27 Aug 2017 00:58:18 +0800 Subject: [PATCH 6/7] update 1.9 Signed-off-by: Bo-Yi Wu --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index c39908c..df859a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ go: - 1.6.x - 1.7.x - 1.8.x + - 1.9 - tip script: From 51f0ef8b07e973afb8b6c192bf90d5c3e575c01a Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 17 Sep 2017 10:20:32 +0800 Subject: [PATCH 7/7] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index df859a8..42cd6a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ go: - 1.6.x - 1.7.x - 1.8.x - - 1.9 + - 1.9.x - tip script: