Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11011 (new enhancement)

Opened 3 months ago

Last modified 1 month ago

[PATCH] Update Accept Header to include JSON and XHTML

Reported by: cfis Assigned to: sam
Priority: low Milestone: 2.x
Component: Prototype Version: edge
Severity: minor Keywords: 1.6.0.3
Cc: Tobie

Description

Line 1261 or so in latest Prototype:

'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'

Due to the importance of JSON, it seems reasonable to also include it. Also, xhtml should be included, at least for non-IE browser, to match their default behaviours.

So:

'Accept': 'text/javascript, text/html, application/xhtml+xml, application/xml, text/xml, application/json'

Attachments

accept_header_additions.diff (3.1 kB) - added by jdalton on 04/01/08 20:28:48.

Change History

02/05/08 02:21:33 changed by cfis

Probably better:

'Accept': 'text/javascript, text/html, application/xml, text/xml, application/json'

...

// Add in XHTML for everything but IE if (!Prototype.Browser.IE)

headersAccept? = 'application/xhtml+xml, ' + headersAccept?

02/05/08 03:14:06 changed by Tobie

  • keywords set to 1.6.0.3.

02/05/08 04:43:52 changed by Tobie

Patched welcomed!

03/27/08 19:48:15 changed by jdalton

It does eventually accept it via the */* I think the order was done this way to support rails 1.1+ http://ajaxian.com/archives/using-the-http-accept-header-for-ajax

03/27/08 19:49:42 changed by jdalton

  • priority changed from normal to low.
  • type changed from defect to enhancement.
  • severity changed from normal to minor.

04/01/08 19:22:05 changed by jdalton

  • cc set to Tobie.

Does this really need a patch or is the */* enough?

04/01/08 20:05:25 changed by cfis

*/* is a fairly blunt instrument, so I think adding json makes sense. Alternatively of course, the whole thing could just be */*, but that defeats the purpose of content negotiation (which I think is a much more useful then people give it credit for, particularly with Ajax calls where clients can actually use it effectively).

04/01/08 20:28:48 changed by jdalton

  • attachment accept_header_additions.diff added.

04/01/08 20:29:37 changed by jdalton

  • summary changed from Update Accept Header to include JSON and XHTML to [PATCH] Update Accept Header to include JSON and XHTML.