Skip to content
Myr

refactored req.accepts()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 524b515 · Browse files · 1 file+5 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−6 removed

  • other:+5 added−6 removed

1 file+5 added−6 removed

modified:lib/express/request.js+5 added-6 removed
94 unmodified lines
95 // Allow "html" vs "text/html" etc96 if (type.indexOf('/') < 0) {97 type = mime.types['.' + type];98 }99100 // Check if we have a direct match100 if (accept.indexOf(type) >= 0) {101 return true;101 if (~accept.indexOf(type)) return true;102103 // Check if we have type/*103 } else {104 type = type.split('/')[0] + '/*';105 return accept.indexOf(type) >= 0;104 type = type.split('/')[0] + '/*';105 return accept.indexOf(type) >= 0;106 }106 } else {107 return false;108 }109};
166 unmodified lines