Set correct content-type for o-r-c curl calls

They contained json data, so they need application/json as the
content types. Else, some wsgi implementations will interpret the
contents in an undesired way, such as apache's mod_wsgi setting the
whole POST body as a POST parameter with no value.

Change-Id: Id988e8d286761550da4849c0695f5f5a37116a11
Closes-Bug: #1641589
This commit is contained in:
Juan Antonio Osorio Robles 2016-11-14 15:43:24 +02:00
parent e481995b19
commit 8688c2878a
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ call_curl() {
local method=$1
local url=$2
local output=$(mktemp)
status=$(curl -s -w %{http_code} -X $method -H 'Content-Type:' -o $output --data-binary "{\"Status\" : \"SUCCESS\",\"Reason\" : \"Configuration Complete\",\"UniqueId\" : \"$ID\",\"Data\" : \"Finished os-refresh-config.\"}" $url)
status=$(curl -s -w %{http_code} -X $method -H 'Content-Type: application/json' -o $output --data-binary "{\"Status\" : \"SUCCESS\",\"Reason\" : \"Configuration Complete\",\"UniqueId\" : \"$ID\",\"Data\" : \"Finished os-refresh-config.\"}" $url)
cat $output
rm $output
if [ "$status" != "200" ]; then
@ -29,7 +29,7 @@ call_curl_deployment() {
local url=$2
local stdout=$3
local output=$(mktemp)
status=$(curl -s -w %{http_code} -X $method -H 'Content-Type:' -o $output --data-binary "{\"deploy_stdout\": \"$stdout\", \"deploy_status_code\": \"0\"}" $url)
status=$(curl -s -w %{http_code} -X $method -H 'Content-Type: application/json' -o $output --data-binary "{\"deploy_stdout\": \"$stdout\", \"deploy_status_code\": \"0\"}" $url)
cat $output
rm $output
if [ "$status" != "200" ]; then