Skip to content
Myr

req.acceptsCharsets.js

This file

Path

test/req.acceptsCharsets.js

49 lines · 1.2 KiB · JavaScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 6bc7574 point at it.

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 1–49why, one step back
1
2var express = require('../')3 , request = require('supertest');45describe('req', function(){6 describe('.acceptsCharsets(type)', function(){7 describe('when Accept-Charset is not present', function(){8 it('should return true', function(done){9 var app = express();1011 app.use(function(req, res, next){12 res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no');13 });1415 request(app)16 .get('/')17 .expect('yes', done);18 })19 })2021 describe('when Accept-Charset is not present', function(){22 it('should return true when present', function(done){23 var app = express();2425 app.use(function(req, res, next){26 res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no');27 });2829 request(app)30 .get('/')31 .set('Accept-Charset', 'foo, bar, utf-8')32 .expect('yes', done);33 })3435 it('should return false otherwise', function(done){36 var app = express();3738 app.use(function(req, res, next){39 res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no');40 });4142 request(app)43 .get('/')44 .set('Accept-Charset', 'foo, bar')45 .expect('no', done);46 })47 })48 })49})