mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
Use t.Sub(time.Now()) because time.Until isn't available until go 1.8
This commit is contained in:
parent
d06b0102ce
commit
a4e4a4476c
|
@ -127,7 +127,7 @@ func (c *Client) Send(req *http.Request, v interface{}) error {
|
|||
// client.Token will be updated when changed
|
||||
func (c *Client) SendWithAuth(req *http.Request, v interface{}) error {
|
||||
if c.Token != nil {
|
||||
if !c.tokenExpiresAt.IsZero() && time.Until(c.tokenExpiresAt) < RequestNewTokenBeforeExpiresIn {
|
||||
if !c.tokenExpiresAt.IsZero() && c.tokenExpiresAt.Sub(time.Now()) < RequestNewTokenBeforeExpiresIn {
|
||||
// c.Token will be updated in GetAccessToken call
|
||||
if _, err := c.GetAccessToken(); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue
Block a user