Skip to content
Myr

res.locals.js

This file

Path

test/res.locals.js

40 lines · 733 bytes · JavaScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 2027b87 point at it.

fix(deps): cookie@0.7.0Josh Bukerbefore adoption2027b87

lines 1–40why, one step back
1'use strict'
23var express = require('../')4 , request = require('supertest');56describe('res', function(){7 describe('.locals', function(){8 it('should be empty by default', function(done){9 var app = express();1011 app.use(function(req, res){12 res.json(res.locals)13 });1415 request(app)16 .get('/')17 .expect(200, {}, done)18 })19 })2021 it('should work when mounted', function(done){22 var app = express();23 var blog = express();2425 app.use(blog);2627 blog.use(function(req, res, next){28 res.locals.foo = 'bar';29 next();30 });3132 app.use(function(req, res){33 res.json(res.locals)34 });3536 request(app)37 .get('/')38 .expect(200, { foo: 'bar' }, done)39 })40})