lisp - Accessing Hunchentoot request objects from the REPL for debugging -


i find incremental development tends break when coding hunchentoot.

for example, might write web page composed of few functions. if 1 of these inner functions contains call - - hunchentoot:post-parameters* can't test function in repl. it'll error out because *request* doesn't exist unless page called web client.

it nice if function-or-other-source existed such test my-function thus:

>(let* ((*request* (get-previous-request-from-somewhere))        (*session* (slot-value *request* 'hunchentoot:session)))     (my-function <whatever params>)) 

does or similar exist? overlooking better approach debugging?

my interim solution looks this:

(defparameter *save-last-request* t) (defvar *last-request* nil)  (defun store-request ()   (when *save-last-request*     (setf *last-request* *request*)))  (defmacro with-last-request (&body body)   `(let* ((*request* *last-request*)       (*session* (slot-value *request* 'hunchentoot:session)))     ,@body)) 

it works fine caveat each handler needs make call store-request.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -