Nanciee/cypress-autorecord

Fetch() defaults to 'get' as method (instead of 'GET')

Closed this issue · 2 comments

In our project the browsers fetch() function seems to default the request method to get (instead of uppercase GET); and since the supportedMethods array is all uppercase, this breaks our tests when running with the recorded mocks.

Recording is fine though, but the JSON is incompatible (or lowercase get needs to be added to supportedMethods):

Screenshot from 2021-01-06 11-32-01

This seems to 'fix' the issue: const supportedMethods = ['get', 'GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];

Thanks for raising this! I'll add in a quick fix this for this. Was this only limited to 'get' or would other request types need to be added as well?

Thanks! Only the lowercase 'get' gave issues for us, no other request types as far as we've experienced.