lib/rest: add support for setting trailers
This commit is contained in:
committed by
Nick Craig-Wood
parent
5dd51e6149
commit
47f9ab2f56
@@ -146,6 +146,7 @@ type Opts struct {
|
||||
MultipartFileName string // ..name of the file for the attached file
|
||||
Parameters url.Values // any parameters for the final URL
|
||||
TransferEncoding []string // transfer encoding, set to "identity" to disable chunked encoding
|
||||
Trailer *http.Header // set the request trailer
|
||||
Close bool // set to close the connection after this transaction
|
||||
NoRedirect bool // if this is set then the client won't follow redirects
|
||||
}
|
||||
@@ -239,6 +240,9 @@ func (api *Client) Call(ctx context.Context, opts *Opts) (resp *http.Response, e
|
||||
if len(opts.TransferEncoding) != 0 {
|
||||
req.TransferEncoding = opts.TransferEncoding
|
||||
}
|
||||
if opts.Trailer != nil {
|
||||
req.Trailer = *opts.Trailer
|
||||
}
|
||||
if opts.Close {
|
||||
req.Close = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user