diff --git a/src/Console/Commands/CurlCommand.php b/src/Console/Commands/CurlCommand.php index aebaaf2..03d839c 100644 --- a/src/Console/Commands/CurlCommand.php +++ b/src/Console/Commands/CurlCommand.php @@ -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'; @@ -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'), diff --git a/tests/Feature/Console/Commands/CurlCommandTest.php b/tests/Feature/Console/Commands/CurlCommandTest.php index db62d3d..a871dc4 100644 --- a/tests/Feature/Console/Commands/CurlCommandTest.php +++ b/tests/Feature/Console/Commands/CurlCommandTest.php @@ -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'],