File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed
Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1+ * milk
2+ * eggs
3+ * bread
Original file line number Diff line number Diff line change @@ -7,11 +7,12 @@ var path = require('path');
77var app = module . exports = express ( ) ;
88
99app . get ( '/' , function ( req , res ) {
10- res . send ( '<ul>'
11- + '<li>Download <a href="/files/amazing.txt">amazing.txt</a>.</li>'
12- + '<li>Download <a href="/files/missing.txt">missing.txt</a>.</li>'
13- + '<li>Download <a href="/files/CCTV大赛上海分赛区.txt">CCTV大赛上海分赛区.txt</a>.</li>'
14- + '</ul>' ) ;
10+ res . send ( '<ul>' +
11+ '<li>Download <a href="/files/notes/groceries.txt">notes/groceries.txt</a>.</li>' +
12+ '<li>Download <a href="/files/amazing.txt">amazing.txt</a>.</li>' +
13+ '<li>Download <a href="/files/missing.txt">missing.txt</a>.</li>' +
14+ '<li>Download <a href="/files/CCTV大赛上海分赛区.txt">CCTV大赛上海分赛区.txt</a>.</li>' +
15+ '</ul>' )
1516} ) ;
1617
1718// /files/* is accessed via req.params[0]
Original file line number Diff line number Diff line change @@ -11,6 +11,15 @@ describe('downloads', function(){
1111 } )
1212 } )
1313
14+ describe ( 'GET /files/notes/groceries.txt' , function ( ) {
15+ it ( 'should have a download header' , function ( done ) {
16+ request ( app )
17+ . get ( '/files/notes/groceries.txt' )
18+ . expect ( 'Content-Disposition' , 'attachment; filename="groceries.txt"' )
19+ . expect ( 200 , done )
20+ } )
21+ } )
22+
1423 describe ( 'GET /files/amazing.txt' , function ( ) {
1524 it ( 'should have a download header' , function ( done ) {
1625 request ( app )
You can’t perform that action at this time.
0 commit comments