Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if payload's bytes, don't wrap in a list for clack #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

strawhatguy
Copy link

@strawhatguy strawhatguy commented Sep 10, 2022

The payload for clack/woo can be a pathname, a list of strings, AND a vector of bytes; the latter allows web server to generate bytes (image, pdf, etc) without needing it to be a file on disk.

Before, returning a vector would complain about being the wrong type.

e.g. something like this now works, where it didn't before - find-static-file just returns a pathname of a png:

(snooze:defresource img (verb content-type name)
  (:route (:get :image/png filename)
          (let ((realpath (format nil "~a.png" (string-downcase filename))))
            (alexandria:read-file-into-byte-vector (find-static-file "img" realpath)))))

The payload can be a pathname, a list of strings, AND a vector of
bytes; the latter allows web server to generate bytes (image, pdf,
etc) without needing it to be a file on disk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant