@@ -28,13 +28,14 @@ describe('handlers/error-pages', () => {
2828 it ( 'defaults to status code 500 if none is specified in the error' , ( ) => {
2929 let ldp = { noErrorPages : true }
3030 let req = { app : { locals : { ldp } } }
31- let res = { status : sinon . stub ( ) , send : sinon . stub ( ) }
31+ let res = { status : sinon . stub ( ) , send : sinon . stub ( ) , header : sinon . stub ( ) }
3232 let err = { message : 'Unspecified error' }
3333 let next = { }
3434
3535 errorPages . handler ( err , req , res , next )
3636
3737 expect ( res . status ) . to . have . been . calledWith ( 500 )
38+ expect ( res . header ) . to . have . been . calledWith ( 'Content-Type' , 'text/plain;charset=utf-8' )
3839 expect ( res . send ) . to . have . been . calledWith ( 'Unspecified error\n' )
3940 } )
4041 } )
@@ -47,12 +48,14 @@ describe('handlers/error-pages', () => {
4748 }
4849 let res = {
4950 status : sinon . stub ( ) ,
51+ header : sinon . stub ( ) ,
5052 send : sinon . stub ( )
5153 }
5254
5355 errorPages . sendErrorResponse ( statusCode , res , error )
5456
5557 expect ( res . status ) . to . have . been . calledWith ( 404 )
58+ expect ( res . header ) . to . have . been . calledWith ( 'Content-Type' , 'text/plain;charset=utf-8' )
5659 expect ( res . send ) . to . have . been . calledWith ( 'Error description\n' )
5760 } )
5861 } )
@@ -78,6 +81,7 @@ describe('handlers/error-pages', () => {
7881 let statusCode = 400
7982 let res = {
8083 status : sinon . stub ( ) ,
84+ header : sinon . stub ( ) ,
8185 send : sinon . stub ( )
8286 }
8387 let err = { message : 'Error description' }
@@ -86,6 +90,7 @@ describe('handlers/error-pages', () => {
8690 return errorPages . sendErrorPage ( statusCode , res , err , ldp )
8791 . then ( ( ) => {
8892 expect ( res . status ) . to . have . been . calledWith ( 400 )
93+ expect ( res . header ) . to . have . been . calledWith ( 'Content-Type' , 'text/plain;charset=utf-8' )
8994 expect ( res . send ) . to . have . been . calledWith ( 'Error description\n' )
9095 } )
9196 } )
0 commit comments