joaotavora / snooze

Common Lisp RESTful web development
207 stars 23 forks source link

make-clack-app: add dynamically bound clack-response-headers plist #36

Closed michaeldelago closed 3 months ago

michaeldelago commented 11 months ago

This pull request makes it so users can add response headers to clack apps

The documented redirect-to function looks like below:

(defun redirect-to (url &optional
                          (format-control "Redirected")
                          format-args)
  (setf (hunchentoot:header-out :location) url)
  (snooze:http-condition 303
                         (format nil "~?" format-control format-args)))

If you're using hunchentoot, this is fine, but if you're using clack with something other than hunchentoot (such as woo) it doesn't work since hunchentoot isn't being used

This allows the redirect-to function to look like this:

(defun redirect-to (url &optional (format-control "Redirected") format-args))
    (setf (getf *clack-response-headers* :location) url)
    (http-condition 302 (format nil "~?" format-control format-args)))
boogsbunny commented 4 months ago

This would be super useful. Any plans to merge @joaotavora?

joaotavora commented 4 months ago

Sorry, this flew completely under the radar. I see nothing wrong with it, it's self-contained. But I haven't used snooze in a long time and can't test it. Just reword the commit message according to how the other ones are worded and I'll press the merge button.

boogsbunny commented 4 months ago

I ran into this issue since clack usually binds the request and response to a var.

I've tested that this change works!

Thanks for your swift response.

boogsbunny commented 4 months ago

cc @michaeldelago

joaotavora commented 4 months ago

I can change the commit message myself. Just to busy right now to investigate what it should say.

On Fri, May 31, 2024, 12:25 boogs @.***> wrote:

cc @michaeldelago https://github.com/michaeldelago

— Reply to this email directly, view it on GitHub https://github.com/joaotavora/snooze/pull/36#issuecomment-2141827922, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC6PQ276M4YMJ32INLJ3WTZFBMZTAVCNFSM6AAAAAA65T5GBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRHAZDOOJSGI . You are receiving this because you were mentioned.Message ID: @.***>

boogsbunny commented 3 months ago

bump @joaotavora