@@ -26,6 +26,15 @@ describe('serveIndex(root)', function () {
26
26
. expect ( 200 , done )
27
27
} )
28
28
29
+ it ( 'should include security header' , function ( done ) {
30
+ var server = createServer ( )
31
+
32
+ request ( server )
33
+ . get ( '/' )
34
+ . expect ( 'X-Content-Type-Options' , 'nosniff' )
35
+ . expect ( 200 , done )
36
+ } )
37
+
29
38
it ( 'should serve a directory index' , function ( done ) {
30
39
var server = createServer ( )
31
40
@@ -117,6 +126,16 @@ describe('serveIndex(root)', function () {
117
126
. expect ( / さ く ら \. t x t / )
118
127
. expect ( 200 , done )
119
128
} ) ;
129
+
130
+ it ( 'should include security header' , function ( done ) {
131
+ var server = createServer ( )
132
+
133
+ request ( server )
134
+ . get ( '/' )
135
+ . set ( 'Accept' , 'application/json' )
136
+ . expect ( 'X-Content-Type-Options' , 'nosniff' )
137
+ . expect ( 200 , done )
138
+ } )
120
139
} ) ;
121
140
122
141
describe ( 'when Accept: text/html is given' , function ( ) {
@@ -136,6 +155,16 @@ describe('serveIndex(root)', function () {
136
155
. end ( done ) ;
137
156
} ) ;
138
157
158
+ it ( 'should include security header' , function ( done ) {
159
+ var server = createServer ( )
160
+
161
+ request ( server )
162
+ . get ( '/' )
163
+ . set ( 'Accept' , 'text/html' )
164
+ . expect ( 'X-Content-Type-Options' , 'nosniff' )
165
+ . expect ( 200 , done )
166
+ } )
167
+
139
168
it ( 'should property escape file names' , function ( done ) {
140
169
var server = createServer ( )
141
170
@@ -194,6 +223,16 @@ describe('serveIndex(root)', function () {
194
223
. expect ( / さ く ら \. t x t / )
195
224
. end ( done ) ;
196
225
} ) ;
226
+
227
+ it ( 'should include security header' , function ( done ) {
228
+ var server = createServer ( )
229
+
230
+ request ( server )
231
+ . get ( '/' )
232
+ . set ( 'Accept' , 'text/plain' )
233
+ . expect ( 'X-Content-Type-Options' , 'nosniff' )
234
+ . expect ( 200 , done )
235
+ } )
197
236
} ) ;
198
237
199
238
describe ( 'when Accept: application/x-bogus is given' , function ( ) {
0 commit comments