cloudapi/v1: Return status created in compose handler

This commit is contained in:
sanne 2021-10-07 00:51:13 +02:00 committed by Sanne Raymaekers
parent 12ca5325d6
commit cda54ef926
2 changed files with 7 additions and 3 deletions

View file

@ -384,7 +384,7 @@ func (h *apiHandlers) Compose(ctx echo.Context) error {
var response ComposeResult var response ComposeResult
response.Id = id.String() response.Id = id.String()
return ctx.JSON(http.StatusOK, response) return ctx.JSON(http.StatusCreated, response)
} }
// ComposeStatus handles a /compose/{id} GET request // ComposeStatus handles a /compose/{id} GET request

View file

@ -639,7 +639,8 @@ function collectMetrics(){
} }
function sendCompose() { function sendCompose() {
OUTPUT=$(curl \ OUTPUT=$(mktemp)
HTTPSTATUS=$(curl \
--silent \ --silent \
--show-error \ --show-error \
--cacert /etc/osbuild-composer/ca-crt.pem \ --cacert /etc/osbuild-composer/ca-crt.pem \
@ -648,9 +649,12 @@ function sendCompose() {
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--request POST \ --request POST \
--data @"$REQUEST_FILE" \ --data @"$REQUEST_FILE" \
--write-out '%{http_code}' \
--output "$OUTPUT" \
https://localhost/api/composer/v1/compose) https://localhost/api/composer/v1/compose)
COMPOSE_ID=$(echo "$OUTPUT" | jq -r '.id') test "$HTTPSTATUS" = "201"
COMPOSE_ID=$(jq -r '.id' "$OUTPUT")
} }
function waitForState() { function waitForState() {