format-curl
Advanced tools
Sorry, the diff of this file is not supported yet
| { | ||
| "name": "format-curl", | ||
| "version": "1.1.0", | ||
| "lockfileVersion": 1, | ||
| "requires": true, | ||
| "dependencies": { | ||
| "colors": { | ||
| "version": "1.1.2", | ||
| "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", | ||
| "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", | ||
| "dev": true | ||
| }, | ||
| "diff": { | ||
| "version": "3.4.0", | ||
| "resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz", | ||
| "integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA==", | ||
| "dev": true | ||
| } | ||
| } | ||
| } |
+7
-1
@@ -28,3 +28,5 @@ 'use strict'; | ||
| const headersStrings = headersNames.map(headerName => { | ||
| const headerValue = headers[headerName].replace(/"/g, '\"'); | ||
| const headerValue = typeof headers[headerName] === 'string' | ||
| ? headers[headerName].replace(/"/g, '\"') | ||
| : headers[headerName]; | ||
| return `-H "${headerName}: ${headerValue}"`; | ||
@@ -36,2 +38,6 @@ }); | ||
| if (body) { | ||
| if (typeof body !== 'string') { | ||
| body = JSON.stringify(body); | ||
| } | ||
| res += ` --data '${body.replace(/"/g, '\"')}'`; | ||
@@ -38,0 +44,0 @@ } |
+1
-1
| { | ||
| "name": "format-curl", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "Format curl execution from request params", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+8
-0
@@ -5,2 +5,8 @@ # format-curl | ||
| ## Installation | ||
| ```shell | ||
| npm install --save format-curl | ||
| ``` | ||
| ## Usage | ||
@@ -36,1 +42,3 @@ | ||
| * host/port/scheme/path/hash as params | ||
| * user-argent, cookies as a params (and as curl arguments) | ||
+18
-0
@@ -139,2 +139,20 @@ 'use strict'; | ||
| } | ||
| ], | ||
| [ | ||
| `curl "https://myhost.com" -H "x-header: undefined"`, | ||
| { | ||
| url: 'https://myhost.com', | ||
| headers: { | ||
| 'x-header': undefined | ||
| } | ||
| } | ||
| ], | ||
| [ | ||
| `curl "https://myhost.com" --data '{"foo":"bar"}'`, | ||
| { | ||
| url: 'https://myhost.com', | ||
| body: { | ||
| foo: 'bar', | ||
| }, | ||
| } | ||
| ] | ||
@@ -141,0 +159,0 @@ ]; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
7785
19.95%6
50%233
22.63%43
22.86%1
Infinity%