Files: d456a6cc8589489e558e6164750474ed2cfc961e / 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