Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-79-npm / negotiator / negotiator.js
511 bytesRaw
1 | ; |
2 | |
3 | var Negotiator = require('negotiator'); |
4 | var availableMediaTypes = [ 'text/html', 'text/plain', 'application/json' ]; |
5 | var request = { headers: { } }; |
6 | var negotiator = new Negotiator(request); |
7 | |
8 | var mt1 = negotiator.mediaTypes(); |
9 | var mt2 = negotiator.mediaTypes(availableMediaTypes); |
10 | var mt3 = negotiator.mediaType(availableMediaTypes); |
11 | |
12 | if (mt1.join('+') !== '*/*') return; |
13 | if (mt2.join('+') !== 'text/html+text/plain+application/json') return; |
14 | if (mt3 !== 'text/html') return; |
15 | |
16 | console.log('ok'); |
17 |
Built with git-ssb-web