varnishtest "Test POST->GET conversion"

server s1 {
	rxreq
	txresp \
		-hdr "Connection: close" \
		-body "012345\n"
} -start

varnish v1 -vcl+backend {
	sub vcl_recv {
		if (req.method == "POST") {
			set req.method = "GET";
		}
	}
} -start

client c1 {
	txreq -req POST -url "/" \
		-body "123456789\n"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Varnish == "1001"

	txreq -req POST -url "/" \
		-body "123456789\n"
	rxresp
	expect resp.status == 200
	expect resp.http.X-Varnish == "1003 1002"
}

client c1 -run
