Wapp

Proposal for new public command to construct url with query parameters
Login

Proposal for new public command to construct url with query parameters

(1) By Andreas Kupries (akupries1) on 2018-12-06 06:46:42 [source]

I recently had to construct an url for `wapp-redirect`, which had to
contain query parameters.

Found no nice aPI for constructing such an url, with the qp properly
encoded.

In the end I found `wappInt-enc-qp` and used it roughly like

    append target [wapp-param BASE_URL]
    append target ?sid=[wappInt-enc-qp $sid]
    append target &email=[wappInt-enc-qp $email]
    append target &submitter=[wappInt-enc-qp $submitter]
    wapp-redirect $target

This works. It also depends on wapp internals, and does not look not
very nice.

I would like to propose to expose the general functionality through a
command like

	`wapp-make-url <BASE> arg...`

where the args are key/value pairs and the proc perform the qp encoding
of the values.

My code from above would then become/look like

    set target [wapp-make-url [wapp-param BASE_URL] \
	sid       $sid \
	email     $email \
	submitter $submitter