falco icon indicating copy to clipboard operation
falco copied to clipboard

[BUG] (simulator) set req.http.VALUE = "" should not be [not set]

Open bungoume opened this issue 1 year ago • 0 comments

Describe the problem set req.http.VALUE = ""; andunset req.http.VALUE; should be different, but they seem to behave the same in falco v1.3.0.

VCL code that cause the problem / reproduceable see https://fiddle.fastly.dev/fiddle/2e7f4a1c

// @scope: recv
// @suite: UNSET header
sub test_recv {
    set req.http.VALUE = "V";
    unset req.http.VALUE;
    assert.is_notset(req.http.VALUE);

    set req.http.MESSAGE = req.http.VALUE;
    assert.equal(req.http.MESSAGE, "(null)");
}

// @scope: recv
// @suite: EMPTY header
sub test_recv {
    set req.http.VALUE = "V";
    set req.http.VALUE = "";
    assert.equal(req.http.VALUE, "");

    set req.http.MESSAGE = req.http.VALUE;
    assert.equal(req.http.MESSAGE, "");
}

// @scope: recv
// @suite: NOTSET header
sub test_recv {
    set req.http.VALUE = "V";
    set req.http.VALUE = req.http.NOTSET;
    assert.is_notset(req.http.VALUE);

    set req.http.MESSAGE = req.http.VALUE;
    assert.equal(req.http.MESSAGE, "(null)");
}

Additional context https://github.com/bungoume/falco-vcl-empty-test/blob/main/tests/header.test.vcl

bungoume avatar Dec 26 '23 15:12 bungoume