Skip to content

Commit

Permalink
Merge pull request #11 from aeby/fix/auth-header
Browse files Browse the repository at this point in the history
fix: Don't send empty X-Amz-Security-Token header field
  • Loading branch information
KazuhitoNakamura authored May 6, 2021
2 parents 9b2af41 + 9670282 commit 5be256b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions pure_websocket_subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,21 @@ func signRequest(signer *v4.Signer, url, region string, data []byte) (map[string
return nil, err
}

return map[string]string{
"accept": req.Header.Get("accept"),
"content-encoding": req.Header.Get("content-encoding"),
"content-type": req.Header.Get("content-type"),
"host": req.Host,
"x-amz-date": req.Header.Get("x-amz-date"),
"X-Amz-Security-Token": req.Header.Get("X-Amz-Security-Token"),
"Authorization": req.Header.Get("Authorization"),
}, nil
headers := map[string]string{
"accept": req.Header.Get("accept"),
"content-encoding": req.Header.Get("content-encoding"),
"content-type": req.Header.Get("content-type"),
"host": req.Host,
"x-amz-date": req.Header.Get("x-amz-date"),
"Authorization": req.Header.Get("Authorization"),
}

token := req.Header.Get("X-Amz-Security-Token")
if token != "" {
headers["X-Amz-Security-Token"] = token
}

return headers, nil
}

// Stop ends the subscription.
Expand Down

0 comments on commit 5be256b

Please sign in to comment.