2017-05-12 02:27:23 +00:00
|
|
|
// +build go1.7
|
|
|
|
|
|
|
|
package apns2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2018-08-28 03:02:13 +00:00
|
|
|
// A Context carries a deadline, a cancellation signal, and other values across
|
2017-05-12 02:27:23 +00:00
|
|
|
// 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 {
|
|
|
|
req = req.WithContext(ctx)
|
|
|
|
}
|
|
|
|
return c.HTTPClient.Do(req)
|
|
|
|
}
|