diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 00272651d604cb..5fa8e87ddbd04b 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -662,8 +662,11 @@ const proxySocketHandler = { // data received on the PING acknowlegement. function pingCallback(cb) { return function pingCallback(ack, duration, payload) { - const err = ack ? null : new errors.Error('ERR_HTTP2_PING_CANCEL'); - cb(err, duration, payload); + if (ack) { + cb(null, duration, payload); + } else { + cb(new errors.Error('ERR_HTTP2_PING_CANCEL')); + } }; }