# Pastebin 5vbGiSAV diff --git a/request.go b/request.go index 213e1da..d81c15e 100644 --- a/request.go +++ b/request.go @@ -21,6 +21,7 @@ type Request struct { Opts map[string]string Body io.Reader Headers map[string]string + ctx context.Context } func NewRequest(ctx context.Context, url, command string, args ...string) *Request { @@ -38,6 +39,7 @@ func NewRequest(ctx context.Context, url, command string, args ...string) *Reque Args: args, Opts: opts, Headers: make(map[string]string), + ctx: ctx, } } @@ -79,6 +81,7 @@ func (r *Request) Send(c *http.Client) (*Response, error) { if err != nil { return nil, err } + req = req.WithContext(r.ctx) if fr, ok := r.Body.(*files.MultiFileReader); ok { req.Header.Set("Content-Type", "multipart/form-data; boundary="+fr.Boundary())