Package Exports
- curl-to-har
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (curl-to-har) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
curl-to-har
curl-to-har converts shell curl commands to HAR request objects:
curl --request POST --url 'http://mockbin.com/request?foo=bar&foo=baz' --header 'accept: application/json' --header 'content-type: application/json' --cookie 'foo=bar; bar=baz' --data '{"foo": "bar"}'
{
method: 'POST',
url: 'http://mockbin.com/request',
httpVersion: 'HTTP/1.1',
queryString: [ { name: 'foo', value: 'bar' }, { name: 'foo', value: 'baz' } ],
headers:
[ { name: 'accept', value: 'application/json' },
{ name: 'content-type', value: 'application/json' } ],
cookies: [ { name: 'foo', value: 'bar' }, { name: 'bar', value: 'baz' } ],
postData: { mimeType: 'application/json', text: { foo: 'bar' } }
}
Usage
npm install curl-to-har
var curlToHar = require('curl-to-har');
var curlString = "curl --request POST --url 'http://mockbin.com/request?foo=bar&foo=baz' --header 'accept: application/json' --header 'content-type: application/json' --cookie 'foo=bar; bar=baz' --data '{\"foo\": \"bar\"}'"
var HAR = curlToHAR(input)
console.log(HAR);
Running tests
npm test
For more usage examples, check out the test directory.
-- For any errors, please submit an issue here. Pull requests are most welcome!