step, its function results gets stored in the request handler's
stateis an ephemeral set of key/value pairs created for each request. State is used to pass values between functions, since they are completely isolated and unaware of one another.
modify-urlfunction for example takes the request body (in this case, a URL), and modifies it (by adding
fetch-test) takes that modified URL and makes an HTTP request to fetch it.
withthat make working with request state easier.
aswill assign the value returned by a function to a particular name in state. In the above example,
helloworld-rsis saved into state as
hello. You can think of this just like storing a value into a variable!
withallows the developer to pass a "desired state" into a given function. Rather than passing the entire state with the existing keys, the developer can optionally define a custom state by choosing aliases for some or all of the keys available in request state. This is just like choosing parameter values to pass into function arguments!
fetch-testfunction above will recieve a state object that looks like this:
subowill validate your directive to help ensure that your Directive is correct, including validating that you're not accessing keys that don't exist in state.