Specifying POST tells Compojure that you only want to pass POST requests on to your liberator resource. That part worked. Liberator then received the request and passed it through its workflow.

At the "allowed-method?" decision point, liberator checked your declaration and saw only the default entry of [:get]. It short circuited and returned a "Method Not Allowed" response, as stated in the documentation.

Think of the "POST" wrapper as a middleware that only matches against POST requests. Liberator and Compojure are different libs with slightly overlapping functionality here. Using "ANY" disables Compojure's request type matching, allowing liberator to take care of it exclusively.

gvim <mailto:gvi...@gmail.com>
February 19, 2015 at 9:41 AM


OK, will use ANY. Still puzzled, though, as to why "Method not allowed" was returned when I clearly specifed POST.

gvim

Sam Ritchie <mailto:sritchi...@gmail.com>
February 19, 2015 at 9:20 AM
Try adding

:allowed-methods [:get :post]

to your resource.

You'll want to use "ANY" for all liberator routes, since they manage the responses for incorrect content types internally. If you specify GET or POST, it's up to you to return the proper responses if the methods aren't supported (since Compojure will return nil and try to match further down your list of routes.


gvim <mailto:gvi...@gmail.com>
February 19, 2015 at 8:48 AM


Thanks for spotting that one :). Still not there, though. Now getting simply "Method not allowed".

gvim

Jonathan Barber <mailto:jonathan.bar...@gmail.com>
February 19, 2015 at 5:56 AM
On 18 February 2015 at 22:35, gvim <gvi...@gmail.com <mailto:gvi...@gmail.com>> wrote:

    On 18/02/2015 15:32, Andy- wrote:

        Without having tested it: I think you're "curl -d" format is
        wrong. It's
        not semicolon separated:
        
http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request

        HTH


    That solved the curl data submission problem but I'm still getting
    errors and suspect the POST defroute isn't correct. 'Trouble all
    the examples of :post submissions in the docs are mixed up with
    other factors so it's difficult to isolate the correct information.


Replace "min" with "minute" in the route (or change "minute" in the curl POST to "min"). Because the field names don't agree, the compojure destructing doesn't match and you end up trying to parseInt nil.

Cheers



    gvim

-- You received this message because you are subscribed to the Google
    Groups "Clojure" group.
    To post to this group, send email to clojure@googlegroups.com
    <mailto:clojure@googlegroups.com>
    Note that posts from new members are moderated - please be patient
    with your first post.
    To unsubscribe from this group, send email to
    clojure+unsubscr...@googlegroups.com
    <mailto:clojure%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/clojure?hl=en
    --- You received this message because you are subscribed to the
    Google Groups "Clojure" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to clojure+unsubscr...@googlegroups.com
    <mailto:clojure%2bunsubscr...@googlegroups.com>.
    For more options, visit https://groups.google.com/d/optout.




--
Jonathan Barber <jonathan.bar...@gmail.com <mailto:jonathan.bar...@gmail.com>>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com <mailto:clojure+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
gvim <mailto:gvi...@gmail.com>
February 18, 2015 at 3:35 PM


That solved the curl data submission problem but I'm still getting errors and suspect the POST defroute isn't correct. 'Trouble all the examples of :post submissions in the docs are mixed up with other factors so it's difficult to isolate the correct information.

gvim


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com <http://www.paddleguru.com/>
Twitter <http://twitter.com/paddleguru>// Facebook <http://facebook.com/paddleguru>

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to