varnishtest "Lost reason from pipe to synth"

server s1 {} -start

varnish v1 -vcl+backend {
	import vtc;
	sub vcl_recv {
		if (req.http.workspace) {
			vtc.workspace_alloc(client, -10);
		}
		return (pipe);
	}
	sub vcl_pipe {
		if (req.http.foo) {
			return (synth(505, req.http.foo + "/bar"));
		} else {
			set bereq.http.baz = "baz";
			return (synth(505, bereq.http.baz));
		}
	}
} -start

client c1 {
	txreq -hdr "foo: foo"
	rxresp
	expect resp.reason == "foo/bar"

	txreq
	rxresp
	expect resp.reason == "baz"

	txreq -hdr "workspace: true"
	rxresp
	expect resp.status == 503
} -run
