response.test.js
This file
Path
test/response.test.js
27 lines · 762 bytes · JavaScript
Last changed by
Added response helpersTj Holowaychukbefore adoption874975d
History of this fileTake it
Added response helpersTj Holowaychukbefore adoption874975d
lines 1–27why, one step back12/**3 * Module dependencies.4 */56var express = require('express');78module.exports = {9 '#send()': function(assert){10 var app = express.createServer();1112 app.get('/html', function(req, res){13 res.send('<p>test</p>', { 'Content-Language': 'en' });14 });15 16 app.get('/json', function(req, res){17 res.send({ foo: 'bar' }, {}, 201);18 });1920 assert.response(app,21 { url: '/html' },22 { body: '<p>test</p>', headers: { 'Content-Language': 'en', 'Content-Type': 'text/html; charset=utf8' }});23 assert.response(app,24 { url: '/json' },25 { body: '{"foo":"bar"}', status: 201, headers: { 'Content-Type': 'application/json; charset=utf8' }});26 }27};