Skip to content

Commit

Permalink
Omit request body hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasdinov committed Dec 20, 2022
1 parent 8ba74c2 commit bc6718d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions pkg/es/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"net/http"
"time"

Expand Down Expand Up @@ -58,14 +57,14 @@ func (a AWSSigningTransport) RoundTrip(req *http.Request) (resp *http.Response,
hasher := sha256.New()
payload := []byte("")

if req.Body != nil {
payload, err = io.ReadAll(req.Body)
if err != nil {
return nil, fmt.Errorf("reading request body: %w", err)
}

defer req.Body.Close()
}
//if req.Body != nil {
// payload, err = io.ReadAll(req.Body)
// if err != nil {
// return nil, fmt.Errorf("reading request body: %w", err)
// }
//
// defer req.Body.Close()
//}

hash := hex.EncodeToString(hasher.Sum(payload))

Expand Down

0 comments on commit bc6718d

Please sign in to comment.