response.lisp 877 B

1234567891011121314151617181920212223242526272829303132
  1. (defun merge-plist (p1 p2)
  2. (loop with notfound = '#:notfound
  3. for (indicator value) on p1 by #'cddr
  4. when (eq (getf p2 indicator notfound) notfound)
  5. do (progn
  6. (push value p2)
  7. (push indicator p2)))
  8. p2)
  9. (defun html-response* (response &optional headers)
  10. "This hould be a docstring"
  11. `(
  12. 200
  13. ,(merge-plist '(:content-type "text/html; charset=utf-8" :server "Woo") headers)
  14. (,response)
  15. ))
  16. (defun json-response* (response &optional headers)
  17. "This hould be a docstring"
  18. `(
  19. 200
  20. ,(merge-plist '(:content-type "application/json; charset=utf-8" :server "Woo") headers)
  21. (,response)
  22. ))
  23. (defun plain-response* (response &optional headers)
  24. "This hould be a docstring"
  25. `(
  26. 200
  27. ,(merge-plist '(:content-type "text/plain; charset=utf-8" :server "Woo") headers)
  28. (,response)
  29. ))