diff --git a/test/bin/grep-header b/test/bin/grep-header new file mode 100755 index 0000000..a3d4a6f --- /dev/null +++ b/test/bin/grep-header @@ -0,0 +1,8 @@ +#!/bin/sh + +set -eu + +header="$1" + +sed -e "/^$header:/ !d; s/\r//" + diff --git a/test/gitlab_test.sh b/test/gitlab_test.sh index 10ddb45..4ced1ac 100644 --- a/test/gitlab_test.sh +++ b/test/gitlab_test.sh @@ -18,7 +18,7 @@ test_static_content_served_correctly() { } test_redirects_to_the_correct_host() { - redirect=$(curl-host softwarepublico.dev --head https://softwarepublico.dev/gitlab/dashboard/projects | grep Location:) + redirect=$(curl-host softwarepublico.dev --head https://softwarepublico.dev/gitlab/dashboard/projects | grep-header Location) assertEquals "Location: https://softwarepublico.dev/gitlab/users/sign_in" "$redirect" } diff --git a/test/reverse_proxy_test.sh b/test/reverse_proxy_test.sh index bae2ba4..f1b63a0 100644 --- a/test/reverse_proxy_test.sh +++ b/test/reverse_proxy_test.sh @@ -1,7 +1,7 @@ . $(dirname $0)/test_helper.sh test_redirect_http_to_https() { - local redirect="$(curl --header 'Host: softwarepublico.dev' --head http://$reverseproxy/ | sed -e '/Location:/ !d; s/\r//')" + local redirect="$(curl --header 'Host: softwarepublico.dev' --head http://$reverseproxy/ | grep-header Location)" assertEquals "Location: https://softwarepublico.dev/" "$redirect" } -- libgit2 0.21.2