我正在处理带有数据有效负载的Google Chrome推送通知,而我正在使用npm web-push。在我的push api中,我调用了函数sendNotification()并传递了端点和所需的参数 - public key,authkey和data payload(string)。
但是当我尝试将通知msg推送到GCM时,我总是从GCM得到以下错误。
Error occurred! { [WebPushError: Received unexpected response code]
name: 'WebPushError',
message: 'Received unexpected response code',
statusCode: 400,
headers:
{ 'content-type': 'text/html; charset=UTF-8',
date: 'Fri, 05 Aug 2016 17:26:59 GMT',
expires: 'Fri, 05 Aug 2016 17:26:59 GMT',
'cache-control': 'private, max-age=0',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '1; mode=block',
server: 'GSE',
'alternate-protocol': '443:quic',
'alt-svc': 'quic=":443"; ma=2592000; v="36,35,34,33,32,31,30"',
'accept-ranges': 'none',
vary: 'Accept-Encoding',
connection: 'close' },
body: '<HTML>\n<HEAD>\n<TITLE>UnauthorizedRegistration</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>UnauthorizedRegistration</H1>\n<H2>Error 400</H2>\n</BODY>\n</HTML>\n' }
有没有人有任何想法或建议?