vtest "Write a body to a file"

server s1 {
	fatal
	stream 1 {
		# First, HTTP checks
		rxreq
		expect req.http.Content-Type == "text/plain"

		# Then, payload checks
		write_body req.txt
		shell {grep -q request req.txt}

		txresp -hdr Content-Type text/plain -body response
	} -run

} -start

client c1 -connect ${s1_sock} {
	fatal
	stream 1 {
		txreq -req POST -hdr Content-Type text/plain -body request

		# First, HTTP checks
		rxresp
		expect resp.http.Content-Type == "text/plain"

		# Then, payload checks
		write_body resp.txt
		shell {grep -q response resp.txt}
	} -run
} -run

server s1 -wait
