🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

format-curl

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-curl - npm Package Compare versions

Comparing version
1.1.0
to
1.1.1
.npmignore

Sorry, the diff of this file is not supported yet

+20
{
"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",

@@ -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 @@ ];