Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
go back to using Client.Do (#73)
Browse files Browse the repository at this point in the history
ref #72
nathany authored Jul 15, 2016
1 parent 2d03c35 commit 208a65d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions push/service.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 208a65d

Please sign in to comment.