Skip to content

Commit

Permalink
fix: fix letter casing issue when checking the request method
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-neeraj committed Mar 28, 2024
1 parent 716d2ad commit 6b3f7e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ encryptRequest = async function (encryptionType, pm) {
throw new Error("'pm' object is invalid");
}

if (['get', 'head', 'delete', 'options'].includes(pm.request.method)) {
if (['get', 'head', 'delete', 'options'].includes(pm.request.method.toLowerCase())) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe(`Tests for ${encryptRequest.name}()`, () => {
const mockUpdateFn = jest.fn();
pm.request.body.update = mockUpdateFn;

for (const method of ['get', 'head', 'options', 'delete']) {
for (const method of ['GET', 'head', 'OPTIONS', 'delete']) {
pm.request = { method };
await encryptRequest('mce', pm);
expect(mastercardEncryption).not.toHaveBeenCalled();
Expand Down

0 comments on commit 6b3f7e3

Please sign in to comment.