Skip to content

Commit

Permalink
Add support for 'data-raw' according to issue laravel-shift#8
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel K Modig committed Oct 13, 2022
1 parent c011a2e commit 8c37fc0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Console/Commands/CurlCommand.php
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} {--compressed} {--insecure} {url}';
protected $signature = 'shift:curl {--X|request=} {--G|get} {--H|header=*} {--d|data=*} {--data-raw=*} {--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 All @@ -29,7 +29,7 @@ private function gatherOptions()
'method' => $this->option('get') ? 'GET' : $this->option('request'),
'url' => $this->argument('url'),
'headers' => $this->option('header'),
'data' => $this->option('data'),
'data' => count($this->option('data-raw')) > 0 ? $this->option('data-raw') : $this->option('data'),
'dataUrlEncode' => $this->option('data-urlencode'),
'fields' => $this->option('form'),
'digest' => $this->option('digest'),
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/Console/Commands/CurlCommandTest.php
Expand Up @@ -27,6 +27,7 @@ public function curlCommandFixtures()
'POST request' => ['basic-post'],
'POST request with data' => ['post-with-data'],
'POST request with JSON data' => ['post-json'],
'POST request with JSON data-raw' => ['post-json-data-raw'],
'POST request with multipart/form-data' => ['post-with-form-data'],
'Request with data defaults to POST' => ['request-with-data'],
'Request with form fields defaults to POST' => ['request-with-form-data'],
Expand Down

0 comments on commit 8c37fc0

Please sign in to comment.