#!/usr/bin/env bash # title/detail resolved from messages*.properties for an ErrorResponseException. -> docs/output/i18n.txt set -uo pipefail source "$(dirname "$0")/env.sh" "$MODULE_DIR/scripts/run.sh" advice || exit 1 BODY='{"sku":"SKU-2","quantity":3,"customerEmail":"a@b.co"}' { echo "# OutOfStockException - its own ProblemDetail vs messages.properties vs messages_de.properties" echo echo "## Exception's own text (what the constructor set):" echo " title=\"Insufficient stock\" detail=\"Requested 3 of SKU-2 but only 0 available\"" echo for lang in '' 'de'; do echo "## Accept-Language: ${lang:-}" echo "\$ curl -X POST /orders -d '$BODY'${lang:+ -H 'Accept-Language: $lang'}" curl -s -X POST "$BASE/orders" -H 'Content-Type: application/json' ${lang:+-H "Accept-Language: $lang"} --data "$BODY"; echo; echo done } > "$OUT/i18n.txt" "$MODULE_DIR/scripts/stop.sh" cat "$OUT/i18n.txt"