Skip to content

Commit c92c10d

Browse files
committed
req.accepts: */* wildcard fix.
Look for '*/*' anywhere in the Accept header instead of only supporting it when it's the exact value of the header. IE8 sends: Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */* for which req.accepts('html') returned false.
1 parent bc81e74 commit c92c10d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ req.accepts = function(type){
135135
// normalize extensions ".json" -> "json"
136136
if (type && '.' == type[0]) type = type.substr(1);
137137

138-
// when Accept does not exist, or is '*/*' return true
139-
if (!accept || '*/*' == accept) {
138+
// when Accept does not exist, or contains '*/*' return true
139+
if (!accept || ~accept.indexOf('*/*')) {
140140
return true;
141141
} else if (type) {
142142
// allow "html" vs "text/html" etc

0 commit comments

Comments
 (0)