vtest "Built-in split subroutine"

server s1 {
	rxreq
	txresp -hdr "age: 12" \
	    -hdr "cache-control: public, max-age=10, stale-while-revalidate=20"
} -start

vinyl v1 -vcl+backend {
	sub vcl_req_cookie {
		return; # trust beresp headers
	}

	sub vcl_beresp_stale {
		if (beresp.ttl + beresp.grace > 0s) {
			return; # cache stale responses
		}
	}
} -start

client c1 {
	txreq
	rxresp
	expect resp.status == 200

	txreq -hdr "cookie: unrelated=analytics"
	rxresp
	expect resp.status == 200
} -run

vinyl v1 -expect cache_hit == 1
vinyl v1 -expect cache_hit == cache_hit_grace
