Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #14 from ipfs/feat/add-context
Browse files Browse the repository at this point in the history
feed through context
  • Loading branch information
Stebalien committed Apr 27, 2019
2 parents 7f260a2 + 7b75a8c commit 0b1bf38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
)

type Request struct {
Ctx context.Context
ApiBase string
Command string
Args []string
Expand All @@ -25,6 +26,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
2 changes: 2 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,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 0b1bf38

Please sign in to comment.