laravel-shift / curl-converter

Online tool to convert `curl` requests to Laravel `Http` requests
MIT License
88 stars 10 forks source link

Support `--data-raw` #18

Closed jasonmccreary closed 2 years ago

jasonmccreary commented 2 years ago

The --data-raw option takes some interpretation. The curl docs do not state that it is mutually exclusive from --data. From a quick tests, it seems curl merges the data when called with both --data and --data-raw.

With that said, the common use case for --data-raw seems to be independent. When passed alone, this is the exact data to send in the request payload.

This PR adds support for --data-raw to the specification above - parsing it as form data when mixed with --data or sending it as the raw body when used independently.

jasonmccreary commented 2 years ago

I thought it was optional based on the content type of the request. However, looks like it's not. I'll need to revisit this as I use withBody in two spots.