Skip to content

Commit 6dba53a

Browse files
committed
fix(httpverb): Fixed lowercase issue in method
1 parent a32227e commit 6dba53a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/matcher-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default class MatcherUtils {
3232
static method(httpMethod: HttpMethod): RouteMatcher {
3333
return {
3434
test: (input: RequestInfo, init?: RequestInit) => {
35-
return httpMethod === findRequestMethod(input, init);
35+
return httpMethod === findRequestMethod(input, init).toUpperCase();
3636
}
3737
};
3838
}

test/yet-another-fetch-mock.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,13 @@ describe('FetchMock', () => {
219219

220220
Promise.all([first, second]).then(() => done());
221221
});
222+
223+
it('should support lowercase httpverb', done => {
224+
mock.post('/lowercase', { key: 'BIG-CASE' });
225+
226+
fetchToJson('/lowercase', { method: 'post' }).then(json => {
227+
expect(json.key).toBe('BIG-CASE');
228+
done();
229+
});
230+
});
222231
});

0 commit comments

Comments
 (0)