Accessing query string parameters

Comments

4 comments

  • Will Delves

    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.

    0
    Comment actions Permalink
  • Justin

    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.

    0
    Comment actions Permalink
  • Alex G

    Thanks, Justin! Wasn't aware of the subfield function.

    What does the third argument of the subfield function do? Is it a separator char?

    0
    Comment actions Permalink
  • Justin

    Correct. That specifies the separator.

    0
    Comment actions Permalink

Please sign in to leave a comment.