From a4b0884baf23146ebb64389bdb8a829b09e46d09 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sat, 26 Mar 2022 15:15:20 -0500 Subject: [bugfix] uri formatting string; part 1 --- lazybones-client.lisp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lazybones-client.lisp b/lazybones-client.lisp index 027ed2f..b17dacc 100644 --- a/lazybones-client.lisp +++ b/lazybones-client.lisp @@ -36,7 +36,7 @@ endpoint EP." do (princ term) when (listp term) do (princ (car term)) - when more + when (and more (plusp (length term))) do (princ "-")))) (defun endpoint-defun-route-var-names (ep) @@ -79,12 +79,15 @@ for making requests to endpoint EP." embedded into the body of a defun for making requests to the endpoint EP. It is desienged to be passed to FORMAT, where query paramters are substituted into the string, if they exist." - (str:join "&" - (loop for varname in (endpoint-defun-query-var-names ep) - collect (with-output-to-string (*standard-output*) - (princ "~:[~;") - (princ (string-upcase varname)) - (princ "=~a~]"))))) + (with-output-to-string (*standard-output*) + (loop + for first = t then nil + for varname in (endpoint-defun-query-var-names ep) + do + (princ "~:[~;") + (unless first (princ #\&)) + (princ (string-upcase varname)) + (princ "=~a~]")))) (defun endpoint-defun-dexador-request-uri (app ep) "Returns a string representation of code that generates a URI for @@ -108,7 +111,7 @@ for making requests to endpoint EP." for making requests to the endpoint EP in the app APP." (format nil - "(dexador:~a~%~s~%~{~a~%~})" + "(dexador:~a~%~a~%~{~a~%~})" (string-downcase (symbol-name (lazybones::endpoint-method ep))) (endpoint-defun-dexador-request-uri app ep) '(":content %body%" -- cgit v1.2.3