Skip to content
Myr

Added buffer support to res.send()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 8fdf111 · Browse files · 2 files+19 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+19 added−11 removed

  • tests:+9 added−1 removed
  • other:+10 added−10 removed

2 files+19 added−11 removed

modified:lib/express/response.js+10 added-10 removed
modified:test/response.test.js+9 added-1 removed
1 unmodified line
2/**3 * Module dependencies.4 */56var express = require('express');6var express = require('express'),7 Buffer = require('buffer').Buffer;89module.exports = {10 '#send()': function(assert){11 var app = express.createServer();
19 unmodified lines
31 32 app.get('/error', function(req, res){33 res.send('Oh shit!', { 'Content-Type': 'text/plain' }, 500);34 });35 36 app.get('/buffer', function(req, res){37 res.send(new Buffer('wahoo!'));38 });3940 assert.response(app,41 { url: '/html' },42 { body: '<p>test</p>', headers: { 'Content-Language': 'en', 'Content-Type': 'text/html; charset=utf-8' }});
8 unmodified lines
51 { body: 'Not Found', status: 404, headers: { 'Content-Type': 'text/plain; charset=utf-8' }});52 assert.response(app,53 { url: '/error' },54 { body: 'Oh shit!', status: 500, headers: { 'Content-Type': 'text/plain' }});55 assert.response(app,56 { url: '/buffer' },57 { body: 'wahoo!' });58 },59 60 '#contentType': function(assert){61 var app = express.createServer();
33 unmodified lines