Skip to content

Instantly share code, notes, and snippets.

@fukamachi
Created August 17, 2018 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fukamachi/d04afa8c0b4b0375bf0a485b4e70652a to your computer and use it in GitHub Desktop.
Save fukamachi/d04afa8c0b4b0375bf0a485b4e70652a to your computer and use it in GitHub Desktop.
(ql:quickload '(:clack :http-body))
(defvar *handler*)
(setf *handler*
(clack:clackup (lambda (env)
(if (eq (getf env :request-method) :get)
'(200 (:content-type :text-html)
("<html><head></head><body><form method='post' enctype='multipart/form-data'><input type='file' name='upload'><input type='submit' value='Upload'></form></body></html>"))
`(200 () (,(prin1-to-string (http-body:parse (getf env :content-type) (getf env :content-length) (getf env :raw-body)))))))
:server :woo))
@fukamachi
Copy link
Author

Content BodyのパースでLack.Requestを使うバージョン

(ql:quickload :lack-request)

(defvar *handler*)

(setf *handler*
      (clack:clackup (lambda (env)
                       (if (eq (getf env :request-method) :get)
                           '(200 (:content-type :text-html)
                             ("<html><head></head><body><form method='post' enctype='multipart/form-data'><input type='file' name='upload'><input type='submit' value='Upload'></form></body></html>"))
                           `(200 () (,(prin1-to-string (lack.request:request-parameters
                                                        (lack.request:make-request env)))))))
                     :server :woo))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment