An Express-like HTTP router for Bash compatible with CGI 1.1
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
552 B

# shellcheck disable=SC2154,SC2034
it "Should parse cookies" "$({
HTTP_COOKIE='bob=gob; job=tob'
_exprash_init
output=$(declare -p _exprash_cookies)
expected_output='declare -A _exprash_cookies=([bob]="gob" [job]="tob" )'
[ "$output" == "$expected_output" ]
})"
it "Should get cookie value by name" "$({
HTTP_COOKIE='bob=gob; job=tob'
_exprash_init
[ "$(cookie 'bob')" == 'gob' ]
})"
it "Should determine if a cookie exists by name" "$({
HTTP_COOKIE='bob=gob; job=tob'
_exprash_init
has_cookie 'bob' && ! has_cookie 'kob'
})"