File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,8 @@ export const createClient = ({
298298 const requestInit : MakeRequest [ 'requestInit' ] = {
299299 ...customRequestInit ,
300300 method : 'DELETE' ,
301+ headers : { } ,
302+ body : undefined ,
301303 } ;
302304
303305 await makeRequest ( { endpoint, contentId, requestInit } ) ;
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ describe('requestInit', () => {
118118 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
119119 // @ts -expect-error
120120 expect ( fetchMock . mock . calls [ 0 ] [ 1 ] ) . toEqual ( {
121- method : 'POST ' ,
121+ method : 'PATCH ' ,
122122 headers : new Headers ( {
123123 'Content-Type' : 'application/json' ,
124124 'X-MICROCMS-API-KEY' : 'apiKey' ,
@@ -130,26 +130,23 @@ describe('requestInit', () => {
130130 test ( 'Custom request init added method, headers and body parameters is not overwrited for fetch in delete request.' , async ( ) => {
131131 await client . delete ( {
132132 endpoint : 'list-type' ,
133- content : { title : 'title' } ,
133+ contentId : 'contentId' ,
134134 customRequestInit : {
135135 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
136136 // @ts -expect-error
137137 method : 'GET' ,
138138 headers : {
139139 'X-MICROCMS-API-KEY' : 'OverwrittenApiKey' ,
140140 } ,
141- body : { title : 'Overwritten Title' } ,
142141 } ,
143142 } ) ;
144143 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
145144 // @ts -expect-error
146145 expect ( fetchMock . mock . calls [ 0 ] [ 1 ] ) . toEqual ( {
147- method : 'POST ' ,
146+ method : 'DELETE ' ,
148147 headers : new Headers ( {
149- 'Content-Type' : 'application/json' ,
150148 'X-MICROCMS-API-KEY' : 'apiKey' ,
151149 } ) ,
152- body : JSON . stringify ( { title : 'title' } ) ,
153150 } ) ;
154151 } ) ;
155152} ) ;
You can’t perform that action at this time.
0 commit comments