Commit c6423d0f by Nils Goroll

demo string-extraction of an array

Ref https://gitlab.com/uplex/varnish/libvmod-frozen/issues/1
parent 38c93959
......@@ -17,6 +17,10 @@ varnish v1 -vcl+backend {
p_test.expect(".e");
p_test.expect(".f[0]");
p_test.expect(".f[1]");
# implementation detail: matching the array after it is complete
# is most efficient
p_test.expect(".f");
p_test.expect(".g.1");
p_test.expect(".g.h[0]");
}
......@@ -48,6 +52,11 @@ varnish v1 -vcl+backend {
set resp.http.f1 = p_test.extract(".f[1]");
set resp.http.f1-type = p_test.type(".f[1]");
# implementation detail: matching the array after it is complete
# is most efficient
set resp.http.f = p_test.extract(".f");
set resp.http.f-type = p_test.type(".f");
set resp.http.g1 = p_test.extract({".g.1"});
set resp.http.g1-type = p_test.type({".g.1"});
......@@ -75,6 +84,8 @@ client c1 {
expect resp.http.f0-type == NUMBER
expect resp.http.f1 == -2
expect resp.http.f1-type == NUMBER
expect resp.http.f == "[ 1, -2, 3]"
expect resp.http.f-type == ARRAY
expect resp.http.g1 == "[]"
expect resp.http.g1-type == ARRAY
expect resp.http.gh0 == 7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment