New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

convertapi

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convertapi - npm Package Compare versions

Comparing version
1.13.0
to
1.14.0
+22
-22
lib/client.js

@@ -41,13 +41,12 @@ 'use strict';

};
this.httpsAgent = new _https2.default.Agent({ keepAlive: api.keepAlive });
}
get(path, params = {}, timeout = null) {
const options = {
const options = this.buildOptions({
method: 'get',
url: this.url(path),
headers: this.defaultHeader,
params,
timeout: timeout * 1000,
proxy: this.api.proxy
};
timeout: timeout * 1000
});

@@ -58,12 +57,8 @@ return (0, _axios2.default)(options).then(response => response.data).catch(error => Client.handleError(error));

post(path, params, timeout = null) {
const options = {
const options = this.buildOptions({
method: 'post',
url: this.url(path),
headers: this.defaultHeader,
data: (0, _utils.buildQueryString)(params),
maxContentLength: Infinity,
maxBodyLength: Infinity,
timeout: timeout * 1000,
proxy: this.api.proxy
};
timeout: timeout * 1000
});

@@ -77,8 +72,7 @@ return (0, _axios2.default)(options).then(response => response.data).catch(error => Client.handleError(error));

return _asyncToGenerator(function* () {
const options = {
const options = _this.buildOptions({
url,
timeout: _this.api.downloadTimeout * 1000,
proxy: _this.api.proxy,
responseType: 'stream'
};
});

@@ -117,3 +111,3 @@ const response = yield (0, _axios2.default)(options).catch(function (error) {

const options = {
const options = this.buildOptions({
method: 'post',

@@ -123,8 +117,4 @@ url: this.url('upload'),

data: stream,
maxContentLength: Infinity,
maxBodyLength: Infinity,
timeout: this.api.uploadTimeout * 1000,
proxy: this.api.proxy,
httpsAgent: new _https2.default.Agent({ keepAlive: this.api.keepAlive })
};
timeout: this.api.uploadTimeout * 1000
});

@@ -138,2 +128,12 @@ return (0, _axios2.default)(options).then(response => new _upload_result2.default(response.data)).catch(error => Client.handleError(error));

buildOptions(options) {
return Object.assign({
headers: this.defaultHeader,
maxContentLength: Infinity,
maxBodyLength: Infinity,
proxy: this.api.proxy,
httpsAgent: this.httpsAgent
}, options);
}
static handleError(error) {

@@ -140,0 +140,0 @@ let data;

{
"name": "convertapi",
"version": "1.13.0",
"version": "1.14.0",
"description": "Official convertapi.com API client",

@@ -44,7 +44,7 @@ "main": "./lib/index.js",

"dependencies": {
"axios": "^0.21.1"
"axios": "^1.6.2"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-eslint": "^10.1.0",
"babel-plugin-add-module-exports": "^0.2.1",

@@ -64,5 +64,5 @@ "babel-polyfill": "^6.26.0",

"istanbul": "^1.0.0-alpha",
"mocha": "^5.0.0",
"mocha": "^10.2.0",
"rimraf": "^2.6.2"
}
}

@@ -11,6 +11,2 @@ # ConvertAPI Node.js Client

## Requirements
Node.js v6.0 and later.
## Installation

@@ -17,0 +13,0 @@

@@ -16,13 +16,12 @@ import axios from 'axios';

};
this.httpsAgent = new https.Agent({ keepAlive: api.keepAlive });
}
get(path, params = {}, timeout = null) {
const options = {
const options = this.buildOptions({
method: 'get',
url: this.url(path),
headers: this.defaultHeader,
params,
timeout: timeout * 1000,
proxy: this.api.proxy,
};
});

@@ -35,12 +34,8 @@ return axios(options)

post(path, params, timeout = null) {
const options = {
const options = this.buildOptions({
method: 'post',
url: this.url(path),
headers: this.defaultHeader,
data: buildQueryString(params),
maxContentLength: Infinity,
maxBodyLength: Infinity,
timeout: timeout * 1000,
proxy: this.api.proxy,
};
});

@@ -53,8 +48,7 @@ return axios(options)

async download(url, path) {
const options = {
const options = this.buildOptions({
url,
timeout: this.api.downloadTimeout * 1000,
proxy: this.api.proxy,
responseType: 'stream',
};
});

@@ -91,3 +85,3 @@ const response = await axios(options)

const options = {
const options = this.buildOptions({
method: 'post',

@@ -97,8 +91,4 @@ url: this.url('upload'),

data: stream,
maxContentLength: Infinity,
maxBodyLength: Infinity,
timeout: this.api.uploadTimeout * 1000,
proxy: this.api.proxy,
httpsAgent: new https.Agent({ keepAlive: this.api.keepAlive }),
};
});

@@ -114,2 +104,12 @@ return axios(options)

buildOptions(options) {
return Object.assign({
headers: this.defaultHeader,
maxContentLength: Infinity,
maxBodyLength: Infinity,
proxy: this.api.proxy,
httpsAgent: this.httpsAgent,
}, options);
}
static handleError(error) {

@@ -116,0 +116,0 @@ let data;