curl-to-postmanv2
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -90,9 +90,19 @@ // list of all options that are supported by this module | ||
long: '--basic', | ||
description: 'Overrides previous auth settings', | ||
description: 'Use HTTP Basic authentication', | ||
collectValues: false | ||
}, | ||
{ | ||
long: '--digest', | ||
description: 'Use HTTP Digest authentication', | ||
collectValues: false | ||
}, | ||
{ | ||
long: '--ntlm', | ||
description: 'Use NTLM Digest authentication', | ||
collectValues: false | ||
}, | ||
{ | ||
short: '-u', | ||
long: '--user', | ||
description: 'Basic auth ( -u <username:password>)', | ||
description: 'Username and password for server authentication', | ||
format: '[string]', | ||
@@ -99,0 +109,0 @@ collectValues: false |
@@ -13,3 +13,2 @@ // list of all curl non-argument options which are not necessary | ||
'--crlf', | ||
'--digest', | ||
'--disable-eprt', | ||
@@ -74,3 +73,2 @@ '--disable-epsv', | ||
'--ntlm-wb', | ||
'--ntlm', | ||
'--parallel-max', | ||
@@ -77,0 +75,0 @@ '-Z', |
# cURL to Postman Importer Changelog | ||
#### v1.1.3 (February 03, 2023) | ||
* Fixed issue [#5182](https://github.com/postmanlabs/postman-app-support/issues/5182) where cURL in Windows cmd formats were not imported correctly. | ||
#### v1.3.0 (March 02, 2023) | ||
* Fix for [#8087](https://github.com/postmanlabs/postman-app-support/issues/8087) - Add support to convert digest and NTLM auth types | ||
@@ -9,2 +9,5 @@ #### v1.2.0 (February 07, 2023) | ||
#### v1.1.3 (February 03, 2023) | ||
* Fixed issue [#5182](https://github.com/postmanlabs/postman-app-support/issues/5182) where cURL in Windows cmd formats were not imported correctly. | ||
#### v1.1.2 (January 10, 2023) | ||
@@ -20,3 +23,3 @@ * Changed regex to check for prefix space in url with query parameters for given curl string | ||
#### v1.0.0 (October 18, 2021) | ||
* Fixed issue where file references were not present in imported cURL. | ||
* Fixed issue where file references were not present in imported cURL.◊ | ||
* Fixed issue where formdata value were not un-escaped correctly. | ||
@@ -23,0 +26,0 @@ * Fixed issue where raw formdata string with boundary were not converted as formdata body. |
{ | ||
"name": "curl-to-postmanv2", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Convert a given CURL command to a Postman request", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -198,2 +198,49 @@ const commander = require('commander'), | ||
/** | ||
* Generates the auth object for the request | ||
* | ||
* @param {Object} curlObj The curl object | ||
* @returns {Object} The auth object | ||
*/ | ||
getAuth: function(curlObj) { | ||
let authObject; | ||
// It is a valid cURL to have only username, in that case keep password empty | ||
const userParts = curlObj.user.split(':') || []; | ||
if (userParts.length === 1) { | ||
userParts[1] = ''; | ||
} | ||
if (curlObj.digest === true) { | ||
authObject = { | ||
type: 'digest', | ||
digest: [ | ||
{ key: 'username', value: userParts[0], type: 'string' }, | ||
{ key: 'password', value: userParts[1], type: 'string' } | ||
] | ||
}; | ||
} | ||
else if (curlObj.ntlm === true) { | ||
authObject = { | ||
type: 'ntlm', | ||
ntlm: [ | ||
{ key: 'username', value: userParts[0], type: 'string' }, | ||
{ key: 'password', value: userParts[1], type: 'string' } | ||
] | ||
}; | ||
} | ||
else { | ||
// Fallback to basic auth | ||
authObject = { | ||
type: 'basic', | ||
basic: [ | ||
{ key: 'username', value: userParts[0], type: 'string' }, | ||
{ key: 'password', value: userParts[1], type: 'string' } | ||
] | ||
}; | ||
} | ||
return authObject; | ||
}, | ||
resetProgram: function() { | ||
@@ -524,3 +571,2 @@ this.requestUrl = ''; | ||
request = {}, | ||
basicAuthParts, | ||
content_type, | ||
@@ -580,12 +626,3 @@ urlData = '', | ||
if (curlObj.user) { | ||
basicAuthParts = curlObj.user.split(':') || []; | ||
if (basicAuthParts.length >= 2) { | ||
request.auth = { | ||
type: 'basic', | ||
basic: [ | ||
{ key: 'username', value: basicAuthParts[0], type: 'string' }, | ||
{ key: 'password', value: basicAuthParts[1], type: 'string' } | ||
] | ||
}; | ||
} | ||
request.auth = this.getAuth(curlObj); | ||
} | ||
@@ -592,0 +629,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70871
1200