Get the cancelation signal #2694
Unanswered
jeruktutut2
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I already write code:
middleware:
ctx, cancel := context.WithTimeout(c.Context(), time.Duration(5)*time.Second)
defer cancel()
c.SetUserContext(ctx)
return c.Next()
get the context in next process
c.UserContext()
it is worked if I wait for 5 seconds, and the deadline signal is appeared, however the cancelation signal doesn't appear if I cancel or close the connection (i used postman and click cancel after click send button)
how to get the cancelation signal (or error) if I cancel or close the connection?
I'm sorry if it is already a question / link / issue related to this question and please fell free to share the link
thanks
Beta Was this translation helpful? Give feedback.
All reactions