Skip to content

Commit

Permalink
rename woo conversion when transforming a woo env to request and a re…
Browse files Browse the repository at this point in the history
…quest to woo response.
  • Loading branch information
diasbruno committed Jan 27, 2025
1 parent 3a5c4a5 commit 5480858
Showing 1 changed file with 16 additions and 25 deletions.
41 changes: 16 additions & 25 deletions web-server/woo.lisp
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
(defpackage #:wst.routing.woo
(:use #:cl)
(:import-from #:wst.routing
#:parse-uri
#:response-content
#:response-headers
#:response-status
#:make-request)
(:export
#:woo-env->request
#:response->woo-response))
(:use #:cl))

(in-package :wst.routing.woo)

(defun woo-env->request (env)
(defun request-from-woo-env (env)
(multiple-value-bind (path query hash)
(parse-uri (getf env :request-uri))
(make-request :uri path
:query query
:hash hash
:headers (getf env :headers)
:method (getf env :request-method)
:content-type (getf env :content-type)
:content-length (or (getf env :content-length) 0)
:content (getf env :raw-body)
:data (list :env env))))
(wst.routing:parse-uri (getf env :request-uri))
(wst.routing:make-request :uri path
:query query
:hash hash
:headers (getf env :headers)
:method (getf env :request-method)
:content-type (getf env :content-type)
:content-length (or (getf env :content-length) 0)
:content (getf env :raw-body)
:data (list :env env))))

(defun response->woo-response (response)
(list (response-status response)
(response-headers response)
(list (response-content response))))
(defun response-to-woo-response (response)
(list (wst.routing:response-status response)
(wst.routing:response-headers response)
(list (wst.routing:response-content response))))

0 comments on commit 5480858

Please sign in to comment.