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

Commit 075491a

Browse files
authored
Merge pull request #36 from mercari/build-aps
apns: not inserted apns-expiration header when Expiry is not given.
2 parents d4bad7c + 5376236 commit 075491a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

gaurun/apns_http2.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@ func NewApnsPayloadHttp2(req *RequestGaurunNotification) map[string]interface{}
8686
}
8787

8888
func NewApnsHeadersHttp2(req *RequestGaurunNotification) *push.Headers {
89-
return &push.Headers{
90-
Expiration: time.Now().Add(time.Duration(int64(req.Expiry)) * time.Second).UTC(),
91-
Topic: ConfGaurun.Ios.Topic,
89+
headers := &push.Headers{
90+
Topic: ConfGaurun.Ios.Topic,
9291
}
92+
93+
if req.Expiry > 0 {
94+
headers.Expiration = time.Now().Add(time.Duration(int64(req.Expiry)) * time.Second).UTC()
95+
}
96+
97+
return headers
9398
}
9499

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

0 commit comments

Comments
 (0)