Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 928 Bytes

rontolisp-query-param.md

File metadata and controls

24 lines (19 loc) · 928 Bytes

rontolisp:query-param

(rontolisp:query-param query name)

Returns the url-decoded value of the first name match in a query string, or nil when the name does not appear. query may be nil (the result is then nil too), so the one-liner (rontolisp:query-param (getf env :query-string) "name") works unchanged for requests without a query string inside an rontolisp:http-handler handler.

(rontolisp:query-param "a=1&name=ronto%20lisp" "name")   ; => "ronto lisp"
(rontolisp:query-param "q=1&q=2" "q")   ; => "1"
(rontolisp:query-param "a=1" "missing")   ; => NIL
(rontolisp:query-param nil "a")   ; => NIL

Backend support

Works on every backend and in every WASM mode (Preview 1 included): the library is written in rontolisp itself and is compiled into the program when used. To read all parameters at once use rontolisp:query-params.