Skip to content

Commit d37ecbb

Browse files
committedJul 21, 2015
Merge pull request #1502 from ipfs/hotfix/nil-ctx
if no context set in request, use context.TODO()
2 parents 9978caf + 5873aa2 commit d37ecbb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎commands/http/client.go

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313

1414
cmds "github.com/ipfs/go-ipfs/commands"
1515
config "github.com/ipfs/go-ipfs/repo/config"
16+
17+
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
1618
)
1719

1820
const (
@@ -35,6 +37,14 @@ func NewClient(address string) Client {
3537

3638
func (c *client) Send(req cmds.Request) (cmds.Response, error) {
3739

40+
if req.Context() == nil {
41+
log.Warningf("no context set in request")
42+
err := req.SetRootContext(context.TODO())
43+
if err != nil {
44+
return nil, err
45+
}
46+
}
47+
3848
// save user-provided encoding
3949
previousUserProvidedEncoding, found, err := req.Option(cmds.EncShort).String()
4050
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.