Socket
Socket
Sign inDemoInstall

@vonage/vetch

Package Overview
Dependencies
Maintainers
45
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/vetch - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

1

dist/interfaces/vetchOptions.d.ts

@@ -24,3 +24,4 @@ /// <reference types="node" />

timeout?: number;
appendUserAgent?: string;
agent?: boolean | http.Agent | https.Agent | ((parsedUrl: URL) => boolean | https.Agent | http.Agent);
}

29

dist/vetch.js

@@ -25,5 +25,18 @@ "use strict";

async _defaultAdapter(opts) {
const res = await (0, node_fetch_1.default)(opts.url, opts);
const data = await this.getResponseData(opts, res);
return this.createResponse(opts, res, data);
const { timeout } = opts;
let timeoutId = null;
const fetchConfig = opts;
if (timeout) {
const controller = new AbortController();
timeoutId = setTimeout(() => controller.abort(), timeout);
fetchConfig.signal = controller.signal;
}
try {
const res = await (0, node_fetch_1.default)(opts.url, fetchConfig);
const data = await this.getResponseData(opts, res);
return this.createResponse(opts, res, data);
}
finally {
clearTimeout(timeoutId);
}
}

@@ -91,9 +104,13 @@ async request(opts = {}) {

// Set our user agent
opts.headers['user-agent'] = `@vonage/server-sdk/3.0.0 node/${process.version.replace('v', '')}`;
opts.headers['user-agent'] = [
`@vonage/server-sdk/3.0.0`,
` node/${process.version.replace('v', '')}`,
opts.appendUserAgent ? ` ${opts.appendUserAgent}` : '',
].join('');
// Allow a custom timeout to be used
const httpAgent = new http_1.default.Agent({
timeout: this.defaults.timeout,
timeout: opts.timeout,
});
const httpsAgent = new https_1.default.Agent({
timeout: this.defaults.timeout,
timeout: opts.timeout,
});

@@ -100,0 +117,0 @@ opts.agent = (parsedUrl) => {

{
"name": "@vonage/vetch",
"version": "1.4.0",
"version": "1.5.0",
"description": "Vonage package for server side fetch.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/vonage/vonage-node-sdk/tree/master/packages/vetch#readme",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc