I'd like to store a value, and then have other elements in the chain act on that value.
Example;
local r = http:get( ... some request ...)
assert.response(r).has.status(200)
local value = assert.response(r).has.header("Content-Length")
assert.are.equal(123, value)
So basically status and header assertions (which I can write myself and add to luassert) would operate on the value provided by the response modifier.
It's related to/prerequisite for #135 I think
I tried to add a value to the state parameter that is passed along the chain, but is was unreliable due to all the meta-table magic the state object has. So I ended up with an ugly wrapper on assert that would reset a custom state table (upvalue) on each call, and the modifiers storing data in that upvalue.
What would be the right approach to implement this?
I'd like to store a value, and then have other elements in the chain act on that value.
Example;
So basically
status
andheader
assertions (which I can write myself and add to luassert) would operate on the value provided by theresponse
modifier.It's related to/prerequisite for #135 I think
I tried to add a value to the
state
parameter that is passed along the chain, but is was unreliable due to all the meta-table magic thestate
object has. So I ended up with an ugly wrapper onassert
that would reset a custom state table (upvalue) on each call, and the modifiers storing data in that upvalue.What would be the right approach to implement this?