test: NewUsingIAM mock

This commit is contained in:
Rohan Verma
2018-12-28 14:59:45 +05:30
parent b9b43d4bff
commit f50dc493f8
4 changed files with 83 additions and 15 deletions
+4 -2
View File
@@ -129,13 +129,15 @@ func writeHeaderList(w io.Writer, r *http.Request) {
}
func writeBody(w io.Writer, r *http.Request) {
var b []byte
var (
b []byte
err error
)
// If the payload is empty, use the empty string as the input to the SHA256 function
// http://docs.amazonwebservices.com/general/latest/gr/sigv4-create-canonical-request.html
if r.Body == nil {
b = []byte("")
} else {
var err error
b, err = ioutil.ReadAll(r.Body)
if err != nil {
panic(err)