diff --git a/stub-json/about/tests.sh b/stub-json/about/tests.sh index c61481c..d25f3ad 100755 --- a/stub-json/about/tests.sh +++ b/stub-json/about/tests.sh @@ -1,11 +1,11 @@ #!/bin/bash source ../support/nginx/reload.sh +source ../support/trim.sh function test_json_header { nginx_reload_configuration - type=$(curl --head http://localhost:8080/json | grep "Content-Type:") - trimmed=$(echo "$type" | sed 's/\r//g' | xargs echo -n) + type=$(curl --head http://localhost:8080/json | grep "Content-Type:" | trim) - assertequals "$trimmed" "Content-Type: application/json" + assertequals "$type" "Content-Type: application/json" } diff --git a/support/trim.sh b/support/trim.sh new file mode 100755 index 0000000..6957baf --- /dev/null +++ b/support/trim.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +function trim { + sed 's/\r//g' | xargs echo -n +} \ No newline at end of file