adobe / adobe-dx

A toolkit for AEM to help build exceptional digital experiences.
Apache License 2.0
35 stars 33 forks source link

curl cannot mix -d and -F param (pipe shell script) #195

Closed luckyluke-adobe closed 2 years ago

luckyluke-adobe commented 2 years ago

Expected Behaviour

When running the command ./pipe -d "echo /content" the command should return the items of the resource. (e.g. {"items":["/content"],"size":1})

Actual Behaviour

The command will not output anything nor trigger a request. The reason can be found, when removing the -s -S option in the shell script which usually supresses warnings.

The warning is: Warning: You can only select one HTTP request method! You asked for both POST Warning: (-d, --data) and multipart formpost (-F, --form).

The reason is, that the script mixes the -F param due to the dryRun option with the `-d' param

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. open a terminal
  2. navigate to the folder, which includes the shell script
  3. run the command ./pipe -d "echo /content"

Platform and Version

Scripts pom version: 0.0.3-SNAPSHOT (Adobe DX: 16) Platform: OSX

Sample Code that illustrates the problem

supressing warnings:

function do_curl() { curlCommand="curl -u $user -s -S $opts $server$uri" if [ "$pipe_debug" ]; then echo "$curlCommand" fi eval "$curlCommand" }

adding -F param: d) opts="-F dryRun=true $opts";;

adding -d param: else opts="-d pipe_cmd=\"$cmd\" $opts" do_curl fi

Logs taken while reproducing problem

luckyluke-adobe commented 2 years ago

Thanks @npeltier 🙂