Skip to content

Commit 2f3058c

Browse files
authored
Merge pull request #112 from whiteinge/uppercase-headers-match
Modify the deterministic headers outputs to expect all uppercase
2 parents 2f07f8b + d473f78 commit 2f3058c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ok.sh

+5-4
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,9 @@ _response() {
790790
fi
791791
done
792792

793-
headers="http_version: ${http_version}
794-
status_code: ${status_code}
795-
status_text: ${status_text}
793+
headers="HTTP_VERSION: ${http_version}
794+
STATUS_CODE: ${status_code}
795+
STATUS_TEXT: ${status_text}
796796
"
797797
while IFS=": " read -r hdr val; do
798798
# Headers stop at the first blank line.
@@ -822,7 +822,7 @@ status_text: ${status_text}
822822
{
823823
sub(/^rel="/, "", $2); sub(/"$/, "", $2)
824824
sub(/^ *</, "", $1); sub(/>$/, "", $1)
825-
print "Link_" $2, $1
825+
print "LINK_" toupper($2), $1
826826
}')
827827
" # need trailing newline
828828
;;
@@ -836,6 +836,7 @@ status_text: ${status_text}
836836
# Output requested headers in deterministic order.
837837
for arg in "$@"; do
838838
_log debug "Outputting requested header '${arg}'."
839+
arg="$(printf '%s' "$arg" | awk '{print toupper($0)}')"
839840
output=$(printf '%s' "$headers" | while IFS=": " read -r hdr val; do
840841
[ "$hdr" = "$arg" ] && printf '%s' "$val"
841842
done)

0 commit comments

Comments
 (0)