aboutsummaryrefslogtreecommitdiff
path: root/src/routes.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes.lisp')
-rw-r--r--src/routes.lisp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/routes.lisp b/src/routes.lisp
index 272d579..0de0307 100644
--- a/src/routes.lisp
+++ b/src/routes.lisp
@@ -1,14 +1,14 @@
-(in-package #:routes)
+(in-package #:scgi-routes)
;; Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
;; Note: Not all http methods are yet implemented
;; Missing: :head :put :delete :connect :options :trace :patch
-(defparameter *http-methods*
- '(:get :post))
+(define-constant +http-methods+
+ '(:get :post) :test 'equal)
(deftype http-method ()
- `(member ,@*http-methods*))
+ `(member ,@+http-methods+))
(defun route-method-p (object)
(or (typep object 'http-method)
@@ -239,11 +239,12 @@ route. If no route matches, then ERROR-HANDLER is called."
(let* ((method (assoc-value headers :request-uri))
(uri (assoc-value headers :request-uri))
(query-bindings (quri:uri-query-params uri))
- (route (uri-route uri)))
+ (route (uri-route uri))
+ (fragment (quri:uri-fragment uri)))
(multiple-value-bind (entry path-bindings)
(find-route route method *routes-table*)
(if entry
- (funcall (first entry) headers path-bindings query-bindings
+ (funcall (route-name entry) headers path-bindings query-bindings
fragment)
(funcall error-handler headers)))))
(t (e)