Cookies can be read using the following syntax: req.http.Cookie:user_id.
Is there anything similar for query string parameters (e.g. req.url.qs:user_id)?
So far I’ve been extracting values with a regex, but it would be great to have a helper like the one above.
Agreed - this would be really useful!
The existing URL parameter functions are good (removing, whitelisting etc) - but having a function to get a given parameter value would be great.
I’ll be the first to admit that it’s nowhere near as nice, but it’s closer:
set req.http.value-of-foo = subfield(req.url.qs, "foo", "&");
See here for more on this.
Thanks, Justin! Wasn’t aware of the subfield function.
What does the third argument of the subfield function do? Is it a separator char?
Correct. That specifies the separator.