[hunchentoot-devel] Questions about using the same uri, but a different function for post and get methods.

Jim Barrows jim.barrows at gmail.com
Tue Mar 29 08:19:55 UTC 2011


I have a uri "/my-uri", when a get request is made I want to return whatever
information I have, and when a post request made, I want to update that
information.
I had thought that doing this:

(define-easy-handler(get-business :uri "/business" :default-request-type
:get)()
(with-html-output-to-string (*standard-output* nil :prologue nil :indent t)
(format t "{\"success\":true, \"data\": ~a}"
(encode-json-plist-to-string (business::find-business)))))

(define-easy-handler(post-business :uri "/business" :default-request-type
:post) (business-name)
(with-html-output-to-string( *standard-output* nil :prologue nil :indent t)
(format t "post-business - ~a" business-name)))

would accomplish that.  However, the second handler is always called, for
the get and the post.
I'm new to Lisp, and was wondering what I'm missing.
Any help would be greatly appreciated.
-- 
James A Barrows
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20110329/fc3f8441/attachment.html>


More information about the Tbnl-devel mailing list