Skip to main content

Bug Tracker

Side navigation

#3408 closed bug (fixed)

Opened September 25, 2008 12:25PM UTC

Closed April 17, 2011 05:40PM UTC

ajax accept quality score fix

Reported by: jonrhall Owned by: flesler
Priority: major Milestone: 1.5
Component: ajax Version: 1.2.6
Keywords: ajaxrewrite Cc: jaubourg
Blocked by: Blocking:

*/* is appended to the Accept header of an ajax request that uses dataType.

For "datatype: 'json'" the Accept header is:

"Accept: application/json, text/javascript, */*"

This means every mimetype has the same quality score of 1. Some servers may use order precedence but this is not within the spec (

The fix is simply to reduce the score of */* to below 1:

(25/09/2008 nightly - line 2730)

s.accepts[ s.dataType ] + ", */*" :


s.accepts[ s.dataType ] + ", */*;q=0.8" :

Attachments (0)
Change History (6)

Changed September 25, 2008 04:35PM UTC by flesler comment:1

owner: → flesler
status: newassigned

Changed September 14, 2009 01:45PM UTC by ashb comment:2

Not sure if I should raise this as another bug or not, but I would like the option to not send the "

" at all.

On the subject of the ticket tho, is there a reason the code shouldn't just be

s.accepts[ s.dataType ] + ', ' + s.accepts._default
instead of using a hardcoded "

I will prepare a patch to this effect tomorrow

Changed September 21, 2009 02:40PM UTC by james comment:3

This is also a problem when trying to override the prefered type. I suggest the */* have a quality of 0.1 and the default jquery provided types have a quality of < 1 (say 0.2). This will allow the caller to override the prefered type with a higher quality.

XML has a lot of various types other than the generic "application/xml" and "text/xml", so these generic types should have a lower quality over more specific XML types provided by the calling function.

Changed December 27, 2010 10:36PM UTC by rwaldron comment:4

keywords: → ajaxrewrite

Changed April 17, 2011 05:19PM UTC by timmywil comment:5

cc: → jaubourg

Please confirm this bug is still present in jQuery 1.6b1.

Changed April 17, 2011 05:40PM UTC by john comment:6

milestone: 1.31.5
resolution: → fixed
status: assignedclosed

In fact, it doesn't seem to be - we have "q=0.01" in Ajax now. I'll mark this as fixed in 1.5.