@@ -52,6 +52,14 @@ api.get('/testJSONPResponse', function(req,res) {
52
52
res . jsonp ( { foo : 'bar' } )
53
53
} )
54
54
55
+ api . get ( '/testSendStatus' , function ( req , res ) {
56
+ res . sendStatus ( 200 )
57
+ } )
58
+
59
+ api . get ( '/testSendStatus403' , function ( req , res ) {
60
+ res . sendStatus ( 403 )
61
+ } )
62
+
55
63
// Secondary route
56
64
api2 . get ( '/testJSONPResponse' , function ( req , res ) {
57
65
res . jsonp ( { foo : 'bar' } )
@@ -141,6 +149,18 @@ describe('Response Tests:', function() {
141
149
expect ( result ) . to . deep . equal ( { multiValueHeaders : { 'content-type' : [ 'application/json' ] } , statusCode : 200 , body : '' , isBase64Encoded : false } )
142
150
} ) // end it
143
151
152
+ it ( 'sendStatus 200' , async function ( ) {
153
+ let _event = Object . assign ( { } , event , { path : '/testSendStatus' } )
154
+ let result = await new Promise ( r => api . run ( _event , { } , ( e , res ) => { r ( res ) } ) )
155
+ expect ( result ) . to . deep . equal ( { multiValueHeaders : { 'content-type' : [ 'application/json' ] } , statusCode : 200 , body : 'OK' , isBase64Encoded : false } )
156
+ } ) // end it
157
+
158
+ it ( 'sendStatus 403' , async function ( ) {
159
+ let _event = Object . assign ( { } , event , { path : '/testSendStatus403' } )
160
+ let result = await new Promise ( r => api . run ( _event , { } , ( e , res ) => { r ( res ) } ) )
161
+ expect ( result ) . to . deep . equal ( { multiValueHeaders : { 'content-type' : [ 'application/json' ] } , statusCode : 403 , body : 'Forbidden' , isBase64Encoded : false } )
162
+ } ) // end it
163
+
144
164
it ( 'JSONP response (default callback)' , async function ( ) {
145
165
let _event = Object . assign ( { } , event , { path : '/testJSONPResponse' } )
146
166
let result = await new Promise ( r => api . run ( _event , { } , ( e , res ) => { r ( res ) } ) )
0 commit comments