Google Groups

Re: [nancy-dev] Re: Planning 0.12 : Content Negotiation

Andreas Håkansson Apr 28, 2012 12:36 PM
Posted in group: Nancy Web Framework
The super-duper-happy-path ;)

On Sat, Apr 28, 2012 at 9:27 PM, Prabir Shrestha <> wrote:
That is exactly what I wanted.
Default should be headers, but allow us to customize it so we can use query strings.

On Saturday, April 28, 2012 2:48:44 PM UTC-4, Andreas Håkansson wrote:
Now these are two completely different things. Supporting it out of the box vs being able to set it up yourself. Like most things in Nancy, content negotiation is going to be both convention based and extensible. All conventions in Nancy can be customized. Even though this is still in the planning phase, I can already say that the defaults are going to be header based, but if u want to hook up conventions that are based on the querystring then that should probably not be an issue either.

On Saturday, April 28, 2012 8:20:05 PM UTC+2, Prabir Shrestha wrote:
I wanted to have an option like in webapi where by default it uses http headers, but we can add our custom logic to refer to querystring.

Some clients does not allow to change the http headers. so the only way would be to use querystring.

This is just my personal taste, but I don't want users to open fiddler or use curl just to get new format. I would want the user to directly type in the browser and get the appropriate format.

How would you use content negotiation with http headers here?

If i use url/querystring i can then use the following code without creating a new route for Get["...."] and take advantage of conrtent-negotiation.

Not just with image but same goes for rss feeds and others.

Content-Negotiation should be focused with dealing with http headers, But i just wanted to bring to the notice that having alternatives like querystring/url is also a good way to use content-negotiation.

On Saturday, April 28, 2012 2:01:51 PM UTC-4, Graeme Foster wrote:
I don't think Nancy should be encouraging bad practices like that. Content negotiation allows both parties to have a say in the format; stuffing it into the URI or query string is ugly, removes the weightings (unless you want to make it even uglier) and is pointless.

Why reinvent something that exists in HTTP already and is understood by everyone?

Graeme Foster

On 28 April 2012 18:46, Prabir Shrestha  wrote:
I'm not a fan of content-negotiation especially using http headers. It we would be good to support content negotiation using querystrings too rather then just http headers. or even url.