-
Notifications
You must be signed in to change notification settings - Fork 8k
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
context: inherits context cancelation and deadline from http.Request context for Go>=1.7 #1690
Conversation
Build failing because of Travis timeout, if one of the maintainer can restart the build :) |
…context for Go>=1.7 *gin.Context implements standard context.Context methods, but always returns data as context is still valid. Since Go 1.7, http.Request now contains a context.Context object, which can be controlled by the http.Server to indicates that the context is now closed, and persue of request should be canceled. This implements the propagation of http.Request context methods inside gin.Context to have HTTP context cancelation information at gin.Context level. Signed-off-by: Romain Beuque <romain.beuque@corp.ovh.com>
Codecov Report
@@ Coverage Diff @@
## master #1690 +/- ##
=========================================
+ Coverage 99.4% 99.4% +<.01%
=========================================
Files 41 42 +1
Lines 2023 2029 +6
=========================================
+ Hits 2011 2017 +6
Misses 9 9
Partials 3 3
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.
LGTM
*gin.Context implements standard context.Context methods, but always
returns data as context is still valid. Since Go 1.7, http.Request now
contains a context.Context object, which can be controlled by the
http.Server to indicates that the context is now closed, and persue of
request should be canceled.
This implements the propagation of http.Request context methods inside
gin.Context to have HTTP context cancelation information at gin.Context
level.
This is retro-compatible for Golang 1.6, and have no effect if http.Request have no context (as http.Request always provide context.Background is ctx is nil)