Skip to content

Commit

Permalink
Disable origin checking and rename module to match package
Browse files Browse the repository at this point in the history
  • Loading branch information
armsnyder committed Feb 11, 2021
1 parent 4f6d0ed commit bae144a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/aws/aws-sdk-go/service/apigatewaymanagementapi"
"github.com/aws/aws-sdk-go/service/apigatewaymanagementapi/apigatewaymanagementapiiface"

awswebsocketadapter "github.com/armsnyder/aws-websocket-adapter"
"github.com/armsnyder/awswebsocketadapter"
)

func main() {
Expand Down
3 changes: 3 additions & 0 deletions adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type Adapter struct {
// ServeHTTP upgrades the request from HTTP to WS and then continues to send and receive websocket
// messages over the connection.
func (a *Adapter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Disable origin checking.
a.upgrader.CheckOrigin = func(_ *http.Request) bool { return true }

// Upgrade the HTTP request to WS.
ws, err := a.upgrader.Upgrade(w, r, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/aws/aws-sdk-go/service/apigatewaymanagementapi"
"github.com/aws/aws-sdk-go/service/apigatewaymanagementapi/apigatewaymanagementapiiface"

awswebsocketadapter "github.com/armsnyder/aws-websocket-adapter"
"github.com/armsnyder/awswebsocketadapter"
)

func Example() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/armsnyder/aws-websocket-adapter
module github.com/armsnyder/awswebsocketadapter

go 1.15

Expand Down

0 comments on commit bae144a

Please sign in to comment.