File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ const getBodyMatcher: MatcherGenerator = (route) => {
212
212
}
213
213
214
214
return ( { options : { body, method = 'get' } } ) => {
215
- if ( [ 'get' , 'head' , 'delete' ] . includes ( method . toLowerCase ( ) ) ) {
215
+ if ( [ 'get' , 'head' ] . includes ( method . toLowerCase ( ) ) ) {
216
216
// GET requests don’t send a body so even if it exists in the options
217
217
// we treat as no body because it would never actually make it to the server
218
218
// in the application code
Original file line number Diff line number Diff line change @@ -144,6 +144,25 @@ describe('body matching', () => {
144
144
) . toBe ( true ) ;
145
145
} ) ;
146
146
147
+ it ( 'should match if request is delete' , ( ) => {
148
+ const route = new Route ( {
149
+ body : { foo : 'bar' } ,
150
+ method : 'delete' ,
151
+ response : 200 ,
152
+ } ) ;
153
+
154
+ expect (
155
+ route . matcher ( {
156
+ url : 'http://a.com/' ,
157
+ options : {
158
+ method : 'DELETE' ,
159
+ body : JSON . stringify ( { foo : 'bar' } ) ,
160
+ headers : { 'Content-Type' : 'application/json' } ,
161
+ } ,
162
+ } ) ,
163
+ ) . toBe ( true ) ;
164
+ } ) ;
165
+
147
166
describe ( 'partial body matching' , ( ) => {
148
167
it ( 'match when missing properties' , ( ) => {
149
168
const route = new Route ( {
You can’t perform that action at this time.
0 commit comments