curl-wrap 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -56,12 +56,13 @@ class CurlResponse {
|
|
|
56
56
|
|
|
57
57
|
setCurlJson(json, options = {}) {
|
|
58
58
|
if (!json) return;
|
|
59
|
+
this.curlJson = json;
|
|
59
60
|
const data = json.json || {};
|
|
60
61
|
this.statusCode = data.response_code || 0;
|
|
61
62
|
this.ip = data.remote_ip || '';
|
|
62
63
|
this.url = data.url_effective || data.url || '';
|
|
63
64
|
this.errorMsg = data.errormsg || '';
|
|
64
|
-
this.curlTimeTaken = data.time_total || 0;
|
|
65
|
+
this.curlTimeTaken = Math.round((data.time_total || 0) * 1000);
|
|
65
66
|
|
|
66
67
|
const headers = json.headers || {};
|
|
67
68
|
for (const [key, value] of Object.entries(headers)) {
|
|
@@ -126,9 +127,6 @@ class Curl {
|
|
|
126
127
|
timeout: 120 * 1000,
|
|
127
128
|
// whether to verify ssl certificate
|
|
128
129
|
ignoreSSLError: true,
|
|
129
|
-
// proxy details (should be {address, port, type, auth: {username, password}})
|
|
130
|
-
// type can be http, https, socks
|
|
131
|
-
proxy: {},
|
|
132
130
|
// body of the request (valid in case of POST / PUT / PATCH / DELETE)
|
|
133
131
|
body: '',
|
|
134
132
|
};
|