8 "github.com/aws/aws-sdk-go/aws/awserr"
11 // NoBody is a http.NoBody reader instructing Go HTTP client to not include
12 // and body in the HTTP request.
13 var NoBody = http.NoBody
15 // ResetBody rewinds the request body back to its starting position, and
16 // sets the HTTP Request body reference. When the body is read prior
17 // to being sent in the HTTP request it will need to be rewound.
19 // ResetBody will automatically be called by the SDK's build handler, but if
20 // the request is being used directly ResetBody must be called before the request
21 // is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically
24 // Will also set the Go 1.8's http.Request.GetBody member to allow retrying
25 // PUT/POST redirects.
26 func (r *Request) ResetBody() {
27 body, err := r.getNextRequestBody()
29 r.Error = awserr.New(ErrCodeSerialization,
30 "failed to reset request body", err)
34 r.HTTPRequest.Body = body
35 r.HTTPRequest.GetBody = r.getNextRequestBody