Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #36 from mercari/build-aps
Browse files Browse the repository at this point in the history
apns: not inserted apns-expiration header when Expiry is not given.
  • Loading branch information
kazegusuri authored Jul 25, 2016
2 parents d4bad7c + 5376236 commit 075491a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions gaurun/apns_http2.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,15 @@ func NewApnsPayloadHttp2(req *RequestGaurunNotification) map[string]interface{}
}

func NewApnsHeadersHttp2(req *RequestGaurunNotification) *push.Headers {
return &push.Headers{
Expiration: time.Now().Add(time.Duration(int64(req.Expiry)) * time.Second).UTC(),
Topic: ConfGaurun.Ios.Topic,
headers := &push.Headers{
Topic: ConfGaurun.Ios.Topic,
}

if req.Expiry > 0 {
headers.Expiration = time.Now().Add(time.Duration(int64(req.Expiry)) * time.Second).UTC()
}

return headers
}

func ApnsPushHttp2(token string, service *push.Service, headers *push.Headers, payload map[string]interface{}) error {
Expand Down

0 comments on commit 075491a

Please sign in to comment.