@@ -156,6 +156,14 @@ api.options('/test_options2/:param1/*', function(req,res) {
156
156
res . status ( 200 ) . json ( { method : 'options' , status : 'ok' , path : '/test_options2/:param1/*' , params :req . params } )
157
157
} )
158
158
159
+ api . get ( '/override/head/request' , ( req , res ) => {
160
+ res . status ( 200 ) . header ( 'method' , 'get' ) . json ( { method : 'get' , path : '/override/head/request' } )
161
+ } )
162
+
163
+ api . head ( '/override/head/request' , ( req , res ) => {
164
+ res . status ( 200 ) . header ( 'method' , 'head' ) . json ( { method : 'head' , path : '/override/head/request' } )
165
+ } )
166
+
159
167
/******************************************************************************/
160
168
/*** BEGIN TESTS ***/
161
169
/******************************************************************************/
@@ -304,6 +312,12 @@ describe('Route Tests:', function() {
304
312
expect ( result ) . to . deep . equal ( { headers : { 'content-type' : 'application/json' } , statusCode : 404 , body : '' , isBase64Encoded : false } )
305
313
} ) // end it
306
314
315
+ it ( 'Override HEAD request' , async function ( ) {
316
+ let _event = Object . assign ( { } , event , { path : '/override/head/request' , httpMethod : 'head' } )
317
+ let result = await new Promise ( r => api . run ( _event , { } , ( e , res ) => { r ( res ) } ) )
318
+ expect ( result ) . to . deep . equal ( { headers : { 'content-type' : 'application/json' , 'method' : 'head' } , statusCode : 200 , body : '' , isBase64Encoded : false } )
319
+ } ) // end it
320
+
307
321
} ) // end HEAD tests
308
322
309
323
/******************/
0 commit comments