Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- Support importing cURL commands that use the HTTP QUERY method (RFC 9110-style safe, idempotent query method).

## [v1.8.5] - 2026-06-04

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
validateCurlRequest: function(curlObj) {
// must be a valid method
var validMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'COPY', 'HEAD',
'OPTIONS', 'LINK', 'UNLINK', 'PURGE', 'LOCK', 'UNLOCK', 'PROPFIND'],
'OPTIONS', 'LINK', 'UNLINK', 'PURGE', 'LOCK', 'UNLOCK', 'PROPFIND', 'QUERY'],
singleWordXMethod,
singleWordMethodPrefix = '-X',
reqMethod = _.toUpper(curlObj.request);
Expand Down Expand Up @@ -935,7 +935,7 @@
* get data arg value from raw args as formdata boundary separated string
* is not parsed as any of data options by commander
*/
_.forEach(curlObj.rawArgs, (arg, index) => {

Check warning on line 938 in src/lib.js

View workflow job for this annotation

GitHub Actions / Unit-Tests (12.x)

Expected to return a value at the end of arrow function

Check warning on line 938 in src/lib.js

View workflow job for this annotation

GitHub Actions / Unit-Tests (16.x)

Expected to return a value at the end of arrow function

Check warning on line 938 in src/lib.js

View workflow job for this annotation

GitHub Actions / Unit-Tests (18.x)

Expected to return a value at the end of arrow function
if (_.includes(formDataOptions, arg)) {
formData = _.get(curlObj.rawArgs, index + 1);
return false;
Expand Down
13 changes: 13 additions & 0 deletions test/conversion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ describe('Curl converter should', function() {
});
});

it('parse a cURL command using the HTTP QUERY method', function (done) {
convert({
type: 'string',
data: 'curl \'http://localhost:3000/api/v1/my-api\' -X \'QUERY\'' +
' -H \'accept: application/json\' --data-raw \'{}\''
}, function (err, result) {
expect(result.result).to.equal(true);
expect(result.output[0].data.method).to.equal('QUERY');
expect(result.output[0].data.url).to.equal('http://localhost:3000/api/v1/my-api');
done();
});
});

it('throw an error for a cURL without URL defined correctly', function (done) {
convert({
type: 'string',
Expand Down
Loading