res.attachment.js
This file
Path
test/res.attachment.js
78 lines · 1.9 KiB · JavaScript
Last changed by
Fix res.attachment Unicode filenames in Safari刘星before adoptione606d99
History of this fileTake it
The walk stopped after 200 commits: lines older than 863160a point at it.
3.4.5Jonathan Ongbefore adoption863160a
lines 1–2why, one step back12var express = require('../')remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
line 3why, one step back3 , request = require('supertest');3.4.5Jonathan Ongbefore adoption863160a
lines 4–18why, one step back45describe('res', function(){6 describe('.attachment()', function(){7 it('should Content-Disposition to attachment', function(done){8 var app = express();910 app.use(function(req, res){11 res.attachment().send('foo');12 });1314 request(app)15 .get('/')16 .expect('Content-Disposition', 'attachment', done);17 })18 })remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
line 19why, one step back193.4.5Jonathan Ongbefore adoption863160a
lines 20–32why, one step back20 describe('.attachment(filename)', function(){21 it('should add the filename param', function(done){22 var app = express();2324 app.use(function(req, res){25 res.attachment('/path/to/image.png');26 res.send('foo');27 });2829 request(app)30 .get('/')31 .expect('Content-Disposition', 'attachment; filename="image.png"', done);32 })remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
line 33why, one step back333.4.5Jonathan Ongbefore adoption863160a
lines 34–38why, one step back34 it('should set the Content-Type', function(done){35 var app = express();3637 app.use(function(req, res){38 res.attachment('/path/to/image.png');Merge tag '3.8.0'Douglas Christopher Wilsonbefore adoptiondb4a061
line 39why, one step back39 res.send(new Buffer(4));3.4.5Jonathan Ongbefore adoption863160a
lines 40–46why, one step back40 });4142 request(app)43 .get('/')44 .expect('Content-Type', 'image/png', done);45 })46 })Merge pull request #2058 from thetalecrafter/content-dispositionRoman Shtylmanbefore adoptionbdb3bb9
lines 47–59why, one step back4748 describe('.attachment(utf8filename)', function(){49 it('should add the filename and filename* params', function(done){50 var app = express();5152 app.use(function(req, res){53 res.attachment('/locales/日本語.txt');54 res.send('japanese');55 });5657 request(app)58 .get('/')59 .expect('Content-Disposition', 'attachment;' +Fix res.attachment Unicode filenames in Safari刘星before adoptione606d99
line 60why, one step back60 ' filename="%E6%97%A5%E6%9C%AC%E8%AA%9E.txt";' +Merge pull request #2058 from thetalecrafter/content-dispositionRoman Shtylmanbefore adoptionbdb3bb9
lines 61–77why, one step back61 ' filename*=UTF-8\'\'%E6%97%A5%E6%9C%AC%E8%AA%9E.txt',62 done);63 })6465 it('should set the Content-Type', function(done){66 var app = express();6768 app.use(function(req, res){69 res.attachment('/locales/日本語.txt');70 res.send('japanese');71 });7273 request(app)74 .get('/')75 .expect('Content-Type', 'text/plain; charset=utf-8', done);76 })77 })3.4.5Jonathan Ongbefore adoption863160a
line 78why, one step back78})