aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/package.lisp3
-rw-r--r--src/routes.lisp13
2 files changed, 9 insertions, 7 deletions
diff --git a/src/package.lisp b/src/package.lisp
index c2ea5b2..016f438 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -1,4 +1,5 @@
-(defpackage #:routes
+(defpackage #:scgi-routes
+ (:nicknames #:routes)
(:use #:cl
#:alexandria
#:split-sequence)
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)