]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go
update vendor and go.mod
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / aws / aws-sdk-go / aws / request / request_1_8.go
1 // +build go1.8
2
3 package request
4
5 import (
6 "net/http"
7
8 "github.com/aws/aws-sdk-go/aws/awserr"
9 )
10
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
14
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.
18 //
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
22 // call ResetBody.
23 //
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()
28 if err != nil {
29 r.Error = awserr.New(ErrCodeSerialization,
30 "failed to reset request body", err)
31 return
32 }
33
34 r.HTTPRequest.Body = body
35 r.HTTPRequest.GetBody = r.getNextRequestBody
36 }