-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename woo conversion when transforming a woo env to request and a re…
…quest to woo response.
- Loading branch information
Showing
1 changed file
with
16 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))) |