Re: Content-negotiation in compojure web libraries/frameworks the right way (tm)

2014-11-05 Thread Nils Grunwald
You can take a look at https://github.com/ngrunwald/ring-middleware-format which tries to handle content negociation only in a sane and flexible way for REST api. On Wednesday, November 5, 2014 2:47:02 PM UTC+1, Miguel Ping wrote: > > Hi all, > > What's the best way to do conte

Re: Content-negotiation in compojure web libraries/frameworks the right way (tm)

2014-11-05 Thread Herwig Hochleitner
Liberator is very helpful for this: http://clojure-liberator.github.io/liberator/ 2014-11-05 14:47 GMT+01:00 Miguel Ping : > Hi all, > > What's the best way to do content-negotiation on compojure-based web > frameworks? I know liberator deals with it in a special way, I was

Content-negotiation in compojure web libraries/frameworks the right way (tm)

2014-11-05 Thread Miguel Ping
Hi all, What's the best way to do content-negotiation on compojure-based web frameworks? I know liberator deals with it in a special way, I was wondering if is there anything out there to deal with it like rails does. Right now I have a big cond: (defn handle-home [req] (let [content

Re: Content negotiation?

2009-09-10 Thread Richard Newman
http://github.com/rnewman/clj-conneg/tree/master This is now pretty much finished, apart from more detailed sorting. E.g., you can ask: (conneg/best-allowed-content-type "image/*; q=0.9, text/html; q=0.1, text/plain; q=0.8" #{"image/jpeg"}) => ("image" "jpeg") i.e., it co

Re: Content negotiation?

2009-09-09 Thread Richard Newman
> This might be good to integrate with ring as well? I don't use Ring directly, if at all (just Compojure for now), so it needs to be upstream of that. I have no problem with Ring using it, though. (I imagine that would be trivial if it reached contrib.) --~--~-~--~~~

Re: Content negotiation?

2009-09-09 Thread Richard Newman
>> Could you put it on GitHub anyway? It would be a good way to >> evaluate >> it. > > +1 - I'd be interested in using it. Your wish is my command :) http://github.com/rnewman/clj-conneg/tree/master I haven't finished the complete sorting algorithm yet (it only uses q- vals, not level and '

Re: Content negotiation?

2009-09-09 Thread Lance Carlson
On Thu, Sep 10, 2009 at 6:40 AM, Sean Devlin wrote: >> >> Could you put it on GitHub anyway?  It would be a good way to evaluate >> it. >> >> On Sep 10, 12:36 am, Richard Newman wrote: >>> Would anyone have any interest in a content negotiation library making >

Re: Content negotiation?

2009-09-09 Thread Adrian Cuthbertson
Sep 10, 12:36 am, Richard Newman wrote: >> Would anyone have any interest in a content negotiation library making >> its way into contrib? >> >> That is, a library with a public function that takes an Accept: header >> from an HTTP request, and your server-side pre

Re: Content negotiation?

2009-09-09 Thread Sean Devlin
Could you put it on GitHub anyway? It would be a good way to evaluate it. On Sep 10, 12:36 am, Richard Newman wrote: > Would anyone have any interest in a content negotiation library making   > its way into contrib? > > That is, a library with a public function that takes an Ac

Content negotiation?

2009-09-09 Thread Richard Newman
Would anyone have any interest in a content negotiation library making its way into contrib? That is, a library with a public function that takes an Accept: header from an HTTP request, and your server-side preferences, and spits out which Content-Type you should produce. This is