Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #173 from optman/master
Browse files Browse the repository at this point in the history
http api to support cancel
  • Loading branch information
Stebalien committed Apr 4, 2019
2 parents 2633719 + 4ecd1fa commit 740521c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

type Request struct {
Ctx context.Context
ApiBase string
Command string
Args []string
Expand All @@ -34,6 +35,7 @@ func NewRequest(ctx context.Context, url, command string, args ...string) *Reque
"stream-channels": "true",
}
return &Request{
Ctx: ctx,
ApiBase: url + "/api/v0",
Command: command,
Args: args,
Expand Down Expand Up @@ -113,6 +115,8 @@ func (r *Request) Send(c *http.Client) (*Response, error) {
return nil, err
}

req = req.WithContext(r.Ctx)

// Add any headers that were supplied via the RequestBuilder.
for k, v := range r.Headers {
req.Header.Add(k, v)
Expand Down

0 comments on commit 740521c

Please sign in to comment.