Skip to content

Commit

Permalink
Ignore --insecure and --compressed options (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Källstrand Modig authored Oct 13, 2022
1 parent c089af4 commit c011a2e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Console/Commands/CurlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CurlCommand extends Command
{
protected $signature = 'shift:curl {--X|request=} {--G|get} {--H|header=*} {--d|data=*} {--data-urlencode=*} {--F|form=*} {--digest} {--basic} {--connect-timeout=} {--max-timeout=} {--retry=} {--s|silent} {--u|user=} {--L|location} {url}';
protected $signature = 'shift:curl {--X|request=} {--G|get} {--H|header=*} {--d|data=*} {--data-urlencode=*} {--F|form=*} {--digest} {--basic} {--connect-timeout=} {--max-timeout=} {--retry=} {--s|silent} {--u|user=} {--L|location} {--compressed} {--insecure} {url}';

protected $description = 'Convert a UNIX curl request to an HTTP Client request';

Expand Down Expand Up @@ -39,6 +39,8 @@ private function gatherOptions()
'retry' => $this->option('retry'),
'silent' => $this->option('silent'),
'user' => $this->option('user'),
'compressed' => $this->option('compressed'),
'insecure' => $this->option('insecure'),
];
}
}
2 changes: 2 additions & 0 deletions tests/Feature/Console/Commands/CurlCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function curlCommandFixtures()
'Entire transaction timeout' => ['max-timeout'],
'Ignore location flag' => ['ignore-location-flag'],
'Missing URL scheme' => ['missing-url-scheme'],
'GET request with compressed flag' => ['with-compressed-option'],
'GET request with insecure flag' => ['with-insecure-option'],
];
}

Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/with-compressed-option.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl -H 'Accept: application/json' https://example.com --compressed
2 changes: 2 additions & 0 deletions tests/fixtures/with-compressed-option.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Http::acceptJson()
->get('https://example.com');
1 change: 1 addition & 0 deletions tests/fixtures/with-insecure-option.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl -H 'Accept: application/json' https://example.com --insecure
2 changes: 2 additions & 0 deletions tests/fixtures/with-insecure-option.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Http::acceptJson()
->get('https://example.com');

0 comments on commit c011a2e

Please sign in to comment.