Open mohammed90 opened 4 months ago
So, works?
But breaks other stuff 🤔 https://github.com/caddyserver/caddy/actions/runs/9120010471/job/25076559154?pr=6320#step:9:568
I think this is making all strings nullable? I think that's probably not what we want :thinking: We might need to make a specific function to handle null but only for handle
(or a different set of handlers). It's crashing with a SIGSEGV which is kinda wild but I guess not totally surprising with null
lol
@TristonianJones FYI in case you have any suggestions. The gist of it is we're trying to allow header({"X-Customer-Token": null})
I think (i.e. null values in "JSON-like" config, but probably only for this one matcher/function)
I think this is making all strings nullable? I think that's probably not what we want 🤔 We might need to make a specific function to handle null but only for
handle
(or a different set of handlers). It's crashing with a SIGSEGV which is kinda wild but I guess not totally surprising withnull
lol@TristonianJones FYI in case you have any suggestions. The gist of it is we're trying to allow
header({"X-Customer-Token": null})
I think (i.e. null values in "JSON-like" config, but probably only for this one matcher/function)
Hi @francislavoie, I think part of this issue is that the internal types are map[string]string
and map[string][]string
even though the CEL type is a map(string,dyn)
. If you want to use null
to represent absent, then you can absolutely do this; however, doing so would require handling null
everywhere it could appear, at least as far as the macro is concerned. It's usually a bad idea to relax the constraints conditionally, in one case, but not all cases. Can you omit the key and use 'key-name' in map
instead as the expression for testing existence?
The plain
header
match (non-CEL) supports checking for the absence of a header. The corresponding CEL matcher couldn't achieve the same because it expects a string a slice in the value of header->value map. In the plainheader
matcher, the absence of a value is represented by a nil in-place of zero-slice as the value of the header key in the map. Thenil
only equalsnil
when iterating through the map. We needed an analogous value, i.e.null
.My attempt here is to add support for
null
. I'm stumbling in the dark as I'm not familiar with the cel-go module, but something works, so am I close?Here are the checks I've run:
So, works?