Macro: respond-with-html

Source

(defmacro respond-with-html ((stream-name) &body body)
  ;; TODO put the body in a flet.
  `(progn
     (if *request*
	 ;; if is serving a html request
	 (no-call/cc
	  (with-http-response (*request* *entity*) 
	    (with-http-body (*request* *entity*)
	      ;; there really shouldn't be application errors when rendering the output.
	      ;; If error IS signaled, I have no idea how aserve will behave.
	      (let ((,stream-name (request-reply-stream *request*))) 
		,@body))))
	 ;; or is debugging in lisp
	 (let ((,stream-name *standard-output*))
	   (declare (special ,stream-name))
	   ,@body))
     t))
Source Context