From 208a65d5b76f578844d407d68f1f317346041883 Mon Sep 17 00:00:00 2001 From: Nathan Youngman Date: Fri, 15 Jul 2016 09:46:44 -0600 Subject: [PATCH] go back to using Client.Do (#73) ref #72 --- push/service.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/push/service.go b/push/service.go index a1d7c4d..d1388e1 100644 --- a/push/service.go +++ b/push/service.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "time" @@ -73,15 +74,14 @@ func (s *Service) Push(deviceToken string, headers *Headers, payload []byte) (st req.Header.Set("Content-Type", "application/json") headers.set(req.Header) - tr := s.Client.Transport - if tr == nil { - tr = http.DefaultTransport - } - resp, err := tr.RoundTrip(req) + resp, err := s.Client.Do(req) + if err != nil { - if e, ok := err.(http2.GoAwayError); ok { - // parse DebugData as JSON. no status code known (0) - return "", parseErrorResponse(strings.NewReader(e.DebugData), 0) + if e, ok := err.(*url.Error); ok { + if e, ok := e.Err.(http2.GoAwayError); ok { + // parse DebugData as JSON. no status code known (0) + return "", parseErrorResponse(strings.NewReader(e.DebugData), 0) + } } return "", err }