joaotavora / snooze

Common Lisp RESTful web development
207 stars 22 forks source link

key value pairs with no value from an html form submit (get) #35

Open badbettty opened 1 year ago

badbettty commented 1 year ago

hello

If a snooze 'route' (defroute) receives a 'get' url sent from submitting from an html form (or via cURL or Wget for that matter) that is, just for example:

path/name?param1=&param2=&param3= , or path/name?param3=, or path/name?param2=&param1= , or path/name?param1=&param2="something" etc

received by: (defroute path (:get :text/* name &key param1 param2 param3) ...

The fact that there is effectively no 'value' after the '=', seems to cause snooze to throw an error ( e.g. 400 Bad Request ). Other than in that 'no value' case, all seems fine.

Advice question please: is there a way to go about setting up snooze to handle value-less url query params ?

(as in the case of an html form default behaviour - no javascript - will send all contents even if empty)

Regards to all Cheers Habs

mdbergmann commented 4 months ago

Not sure, didn't try it, but would it be possible to setup default values for the &key parameters? I mean, without default value the parameters are mandatory (in CL). If a GET request has a query parameter with empty value it seems to be optional.