molnarg / node-http2

An HTTP/2 client and server implementation for node.js
MIT License
1.79k stars 187 forks source link

No payload in GOAWAY frame #219

Open ghost opened 7 years ago

ghost commented 7 years ago

I'm trying to send POST request to Apple Push Notifications server (APN). I'm getting GOAWAY frame without payload data, through APN manual states that it must contain a JSON data.

The code I'm using:

var logger = {
    fatal: noop,
    error: noop,
    warn : noop,
    info : noop,
    debug: function(data) {
        console.log(data);  //GOAWAY frame appears with no payload
    },
    trace: noop,
    child: function() { return this; }
};

var req = http2.request({
    hostname: 'api.push.apple.com',
    protocol: 'https:',
    port: 443,
    method: 'POST',
    path: '/3/device/' + deviceToken,
    agent: new http2.Agent({log: logger}),
    headers: {
        'Authorization': 'bearer ' + providerToken,
        'apns-topic': 'web.com.example'
    }
}, function(res) {
    console.log('done');
    res.pipe(process.stdout);
});
req.write(JSON.stringify(post));
req.end();

Should I do extra actions to get a payload?

Thank you very much for this module!