Skip to content
Myr

req.acceptsCharset.js

This file

Path

test/req.acceptsCharset.js

49 lines · 1.2 KiB · JavaScript

Last changed by

remove unnecessary test/support/httpJonathan Ongbefore adoption643397e

History of this file

Take it

The walk stopped after 200 commits: lines older than 34c83d7 point at it.

3.4.7Jonathan Ongbefore adoption34c83d7

lines 1–2why, one step back
1
2var express = require('../')

remove unnecessary test/support/httpJonathan Ongbefore adoption643397e

line 3why, one step back
3 , request = require('supertest');

3.4.7Jonathan Ongbefore adoption34c83d7

lines 4–11why, one step back
4
5describe('req', function(){6 describe('.acceptsCharset(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){

refactor req.is and req.accepts*Jonathan Ongbefore adoptioncec0c06

line 12why, one step back
12 res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no');

3.4.7Jonathan Ongbefore adoption34c83d7

lines 13–25why, one step back
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){

refactor req.is and req.accepts*Jonathan Ongbefore adoptioncec0c06

line 26why, one step back
26 res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no');

3.4.7Jonathan Ongbefore adoption34c83d7

lines 27–38why, one step back
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){

refactor req.is and req.accepts*Jonathan Ongbefore adoptioncec0c06

line 39why, one step back
39 res.end(req.acceptsCharsets('utf-8') ? 'yes' : 'no');

3.4.7Jonathan Ongbefore adoption34c83d7

lines 40–49why, one step back
40 });
4142 request(app)43 .get('/')44 .set('Accept-Charset', 'foo, bar')45 .expect('no', done);46 })47 })48 })49})