I writing a simple HTTP client using the new context support in Go 1.7.
I need to test it in case a timeout is specified and expires, but I'm 
having problems.

The context package defines the Cancel error variable, that is returned 
by Context.Err when the context is canceled.
However the Transport.Roundtrip method returns errRequestCanceled or 
errRequestCanceled, making it impossible to check if error was due to 
request cancelation.

What about adding an `IsCanceled(err error) bool` function to the context 
package, and redefine the errRequestCanceled and errRequestCanceled so that 
context.IsCanceled returns true?
Right now I'm checking if the error message contains the string "canceled".


Thanks
Manlio

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to