🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

fetch-http2

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-http2 - npm Package Compare versions

Comparing version

to
1.0.4

19

dist/http2.js

@@ -6,2 +6,3 @@ "use strict";

const node_http2_1 = require("node:http2");
const defaultPingInterval = 20000;
async function _fetch(url, options) {

@@ -12,3 +13,3 @@ // Construct url

const client = _httpClient(origin, {
keepAlive: options?.keepAlive ?? 5000
pingInterval: parsePingInterval(options?.keepAlive)
});

@@ -53,5 +54,5 @@ // Build http request

let timer;
// Send a ping every 5s to keep client alive
if (typeof options?.keepAlive === 'number') {
timer = (0, node_timers_1.setInterval)(() => client.ping(noop), options.keepAlive).unref();
// Send a ping every to keep client alive
if (options.pingInterval > 0) {
timer = (0, node_timers_1.setInterval)(() => client.ping(noop), options.pingInterval).unref();
}

@@ -103,1 +104,11 @@ // Create function to destroy client

}
function parsePingInterval(keepAlive) {
switch (typeof keepAlive) {
case 'number':
return keepAlive;
case 'boolean':
return keepAlive ? defaultPingInterval : 0;
case 'undefined':
return defaultPingInterval;
}
}
{
"name": "fetch-http2",
"version": "1.0.3",
"version": "1.0.4",
"description": "Native http2 fetch implementation for Node.js",

@@ -5,0 +5,0 @@ "author": "Andrew Barba <barba@hey.com>",