vtest "Test std.getenv"

setenv FOO "BAR BAZ"

vinyl v1 -vcl {
	import std;

	backend dummy { .host = "${bad_backend}"; }

	sub vcl_recv {
		return(synth(200));
	}

	sub vcl_synth {
		set resp.http.X-FOO = std.getenv("FOO");
		set resp.http.X-PATH = std.getenv("PATH");
		set resp.http.X-unset = std.getenv(req.http.unset);
	}
} -start

client c1 {
	txreq
	rxresp
	expect resp.http.X-FOO == "BAR BAZ"
	expect resp.http.X-PATH ~ "^/"
	expect resp.http.X-unset == ""
} -run
