Skip to content

Commit

Permalink
support context.Context
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Nov 25, 2018
1 parent 38b12ac commit b355b6f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions req.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package req
import (
"bytes"
"compress/gzip"
"context"
"encoding/json"
"encoding/xml"
"errors"
Expand Down Expand Up @@ -254,6 +255,8 @@ func (r *Req) Do(method, rawurl string, vs ...interface{}) (resp *Resp, err erro
resp.downloadProgress = vv
case func(int64, int64):
progress = vv
case context.Context:
req = req.WithContext(vv)
case error:
return nil, vv
}
Expand Down

0 comments on commit b355b6f

Please sign in to comment.