diff --git a/.travis.yml b/.travis.yml index 984e5c2e..dd070848 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: go go: - - 1.6.x - 1.7.x - 1.8.x - 1.9.x diff --git a/README.md b/README.md index 7205bbb0..08f84eaa 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ APNS/2 is a go package designed for simple, flexible and fast Apple Push Notific - Uses new Apple APNs HTTP/2 connection - Fast - See [notes on speed](https://github.com/sideshow/apns2/wiki/APNS-HTTP-2-Push-Speed) -- Works with go 1.6 and later +- Works with go 1.7 and later - Supports new Apple Token Based Authentication (JWT) - Supports new iOS 10 features such as Collapse IDs, Subtitles and Mutable Notifications - Supports persistent connections to APNs diff --git a/client_go16.go b/client_go16.go deleted file mode 100644 index 4db66951..00000000 --- a/client_go16.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build go1.6,!go1.7 - -package apns2 - -import ( - "net/http" - - "golang.org/x/net/context" - "golang.org/x/net/context/ctxhttp" -) - -// A Context carries a deadline, a cancellation signal, and other values across -// API boundaries. -// -// Context's methods may be called by multiple goroutines simultaneously. -type Context interface { - context.Context -} - -func (c *Client) requestWithContext(ctx Context, req *http.Request) (*http.Response, error) { - if ctx != nil { - return ctxhttp.Do(ctx, c.HTTPClient, req) - } - return c.HTTPClient.Do(req) -} diff --git a/client_go16_test.go b/client_go16_test.go deleted file mode 100644 index 183b1e9c..00000000 --- a/client_go16_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// +build go1.6,!go1.7 - -package apns2_test - -import ( - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/stretchr/testify/assert" - "golang.org/x/net/context" -) - -func TestClientPushWithContextWithTimeout(t *testing.T) { - const timeout = time.Nanosecond - n := mockNotification() - var apnsID = "02ABC856-EF8D-4E49-8F15-7B8A61D978D6" - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=utf-8") - w.Header().Set("apns-id", apnsID) - w.WriteHeader(http.StatusOK) - })) - defer server.Close() - - ctx, cancel := context.WithTimeout(context.Background(), timeout) - time.Sleep(timeout) - res, err := mockClient(server.URL).PushWithContext(ctx, n) - assert.Error(t, err) - assert.Nil(t, res) - cancel() -} - -func TestClientPushWithContext(t *testing.T) { - n := mockNotification() - var apnsID = "02ABC856-EF8D-4E49-8F15-7B8A61D978D6" - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=utf-8") - w.Header().Set("apns-id", apnsID) - w.WriteHeader(http.StatusOK) - })) - defer server.Close() - - res, err := mockClient(server.URL).PushWithContext(context.Background(), n) - assert.Nil(t, err) - assert.Equal(t, res.ApnsID, apnsID) -}