-
-
Notifications
You must be signed in to change notification settings - Fork 724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
point to the same context after http.Request created #207
Conversation
Codecov Report
@@ Coverage Diff @@
## master #207 +/- ##
==========================================
+ Coverage 96.15% 96.17% +0.01%
==========================================
Files 9 9
Lines 1119 1123 +4
==========================================
+ Hits 1076 1080 +4
Misses 23 23
Partials 20 20
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clippit Thanks for the PR but I'm unable to merge this. Please refer to my inline comment.
@@ -67,6 +70,9 @@ func (r *Request) Context() context.Context { | |||
// documentation. | |||
func (r *Request) SetContext(ctx context.Context) *Request { | |||
r.ctx = ctx | |||
if r.RawRequest != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -55,6 +55,9 @@ type Request struct { | |||
// Context method returns the Context if its already set in request | |||
// otherwise it creates new one using `context.Background()`. | |||
func (r *Request) Context() context.Context { | |||
if r.RawRequest != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. |
This pull request adds checks related to context methods. When http.Request is created, context between resty.Request and http.Request stays the same. This can avoid mess when working with preReqHook.
See #206