File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Management-Utilities/Workload-Factory-API-Samples Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -115,24 +115,27 @@ run_curl () {
115115 echo " Error: Missing required parameters for run_curl function." >&2
116116 exit 1
117117 fi
118+ #
119+ # Since older versions of curl don't support the %{stderr} variable, using the -o option
120+ # to redirect output to the $output file and getting the http_code from standard out.
118121 case " $method " in
119122 GET)
120- curl -sw " %{stderr}%{ http_code},%{errormsg}" " $url " \
123+ curl -sw " %{http_code},%{errormsg}" " $url " \
121124 -H " Accept: $accept " " ${extraHeaders[@]} " \
122- -H " Authorization: Bearer $token " > $output 2 > $errorOutput
125+ -H " Authorization: Bearer $token " -o $output > $errorOutput
123126 exitCode=$?
124127 ;;
125128 POST|PUT)
126- curl -X " $method " -sw " %{stderr}%{ http_code},%{errormsg}" " $url " \
129+ curl -X " $method " -sw " %{http_code},%{errormsg}" " $url " \
127130 -H " Accept: $accept " " ${extraHeaders[@]} " \
128131 -H " Content-Type:application/json" \
129- -H " Authorization: Bearer $token " --data " $data " > $output 2 > $errorOutput
132+ -H " Authorization: Bearer $token " --data " $data " -o $output > $errorOutput
130133 exitCode=$?
131134 ;;
132135 DELETE)
133- curl -X DELETE -sw " %{stderr}%{ http_code},%{errormsg}" " $url " \
136+ curl -X DELETE -sw " %{http_code},%{errormsg}" " $url " \
134137 -H " Accept: $accept " " ${extraHeaders[@]} " \
135- -H " Authorization: Bearer $token " > $output 2 > $errorOutput
138+ -H " Authorization: Bearer $token " -o $output > $errorOutput
136139 exitCode=$?
137140 ;;
138141 * )
You can’t perform that action at this time.
0 commit comments