Friday, 27 September 2013

Hunchentoot dispatch by HTTP method

Hunchentoot dispatch by HTTP method

I couldn't find any documentation on how to dispatch based on HTTP method
(on the same uri). The closest I got was :default-request-type on the
define-easy-handler -- but it seems to dispatch to the latter, even though
I use GET method:
(define-easy-handler (index :uri "/" :default-request-type :get) ()
(log-message* :info "GET on index ------ ")
(format nil "Hello World"))
(define-easy-handler (echo :uri "/" :default-request-type :post) ()
(log-message* :info "POST on index ------ ")
(format nil "~S" (raw-post-data :force-text t)))

No comments:

Post a Comment