Skip to content

Commit b9b49fb

Browse files
authored
Merge pull request #15 from friendsofgo/allow_cors
Fixes #14. Allow CORS requests
2 parents 54242b6 + 6672faf commit b9b49fb

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@
3030
* Dynamic responses based on query params
3131
* Allow organize your imposters with structured folders (using new extension `.imp.json`)
3232
* Allow write multiple imposters by file
33+
34+
## v0.3.1 (2019/05/07)
35+
36+
* Allow CORS requests

cmd/killgrave/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88

99
killgrave "github.com/friendsofgo/killgrave/internal"
10+
"github.com/gorilla/handlers"
1011
"github.com/gorilla/mux"
1112
)
1213

@@ -36,5 +37,5 @@ func main() {
3637

3738
httpAddr := fmt.Sprintf("%s:%d", *host, *port)
3839
log.Printf("The fake server is on tap now: http://%s:%d\n", *host, *port)
39-
log.Fatal(http.ListenAndServe(httpAddr, r))
40+
log.Fatal(http.ListenAndServe(httpAddr, handlers.CORS()(r)))
4041
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/friendsofgo/killgrave
33
go 1.12
44

55
require (
6+
github.com/gorilla/handlers v1.4.0
67
github.com/gorilla/mux v1.7.1
78
github.com/pkg/errors v0.8.1
89
github.com/stretchr/testify v1.3.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/gorilla/handlers v1.4.0 h1:XulKRWSQK5uChr4pEgSE4Tc/OcmnU9GJuSwdog/tZsA=
4+
github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
35
github.com/gorilla/mux v1.7.1 h1:Dw4jY2nghMMRsh1ol8dv1axHkDwMQK2DHerMNJsIpJU=
46
github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
57
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=

0 commit comments

Comments
 (0)