@@ -273,24 +273,26 @@ describe('Body Data Wrapper Unit Tests (YAML Body)', () => {
273273 const contents = { indices : [ ] } ;
274274
275275 [ 'POST' , 'post' , 'PUT' , 'PATCH' ] . forEach ( ( method ) => {
276- it ( `Loads YAML (${ method } )` , async ( ) => {
277- const universalfunct = async ( request , context ) => {
278- const yaml = YAML . parse ( context . data ) ;
279- assert . deepStrictEqual ( yaml , contents ) ;
280- return new Response ( 'ok' ) ;
281- } ;
282-
283- const actualfunct = wrap ( universalfunct ) . with ( bodyData , { supportYAML : true } ) ;
284- const response = await actualfunct ( new Request ( 'http://localhost' , {
285- body : YAML . stringify ( contents ) ,
286- method,
287- headers : {
288- 'content-type' : 'text/yaml' ,
289- } ,
290- } ) , {
291- log,
276+ [ 'text/yaml' , 'application/x-yaml' ] . forEach ( ( yamlType ) => {
277+ it ( `Loads YAML with type ${ yamlType } (${ method } )` , async ( ) => {
278+ const universalfunct = async ( request , context ) => {
279+ const yaml = YAML . parse ( context . data ) ;
280+ assert . deepStrictEqual ( yaml , contents ) ;
281+ return new Response ( 'ok' ) ;
282+ } ;
283+
284+ const actualfunct = wrap ( universalfunct ) . with ( bodyData , { supportYAML : true } ) ;
285+ const response = await actualfunct ( new Request ( 'http://localhost' , {
286+ body : YAML . stringify ( contents ) ,
287+ method,
288+ headers : {
289+ 'content-type' : yamlType ,
290+ } ,
291+ } ) , {
292+ log,
293+ } ) ;
294+ assert . strictEqual ( response . status , 200 , 'universal function should be executed' ) ;
292295 } ) ;
293- assert . strictEqual ( response . status , 200 , 'universal function should be executed' ) ;
294296 } ) ;
295297 } ) ;
296298
0 commit comments