Subject: Re: [apps-discuss] draft-nottingham-http-problem-04 and content types

From: Julian Reschke <[email-masked]>
Date: Mon, 21 Jul 2014 19:06:41 +0200

On 2013-11-04 04:54, Erik Wilde wrote:
> ...
> i don't think there's anything special about the HTTP problem types
> here. if a server supports both variants, and a client does not specify
> a preferred variant, or does not distinguish which one it prefers when
> asking for both, then it's up to the server to respond which whatever it
> thinks is the better default choice:
>
> - maybe JSON because on average, people seem to like JSON better these
> days.
>
> - maybe XML, because you can associate it with an XSLT and thus render a
> nice human-readable response in a browser.
>
> it really is up to the server to decide what to do; it could even serve
> XML/XSLT to browser clients, and JSON to non-browser clients. as
> http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-24#section-5.3.2
> puts it:
>
> "A request without any Accept header field implies that the user agent
> will accept any media type in response."
>
> cheers,
>
> dret.
> ...

I'm a bit concerned about the "non-browser clients". Are you suggesting 
to inspect the User Agent header field?

In general, there'll be cases where the request comes from a browser 
(thus UA sniffing doesn't help), the preferred result is text/html on 
success (XHR code getting HTML fragments), but the preferred result for 
failure cases would be JSON.

Maybe another case for "Prefer:"?

Best regards, Julian