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

http api to support cancel #173

Merged
merged 2 commits into from
Apr 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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