Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response always undefined in .calls? #638

Open
th3fallen opened this issue May 5, 2022 · 0 comments
Open

Response always undefined in .calls? #638

th3fallen opened this issue May 5, 2022 · 0 comments

Comments

@th3fallen
Copy link

th3fallen commented May 5, 2022

Please read the documentation before raising an issue

Be clear and precise about what the issue is. Take the time to include details of
what's wrong, including the version of fetch-mock you're using and which environment
it's running in.

  • Bad: 'It doesn't work', 'It conflicts with x', 'I get an error'
  • Good: 'When using webpack 4 and babel 7 I get an Error: undefined array at line 191
    during compilation'
    When using webpack 5 and babel 7 I am unable to get the responses back from any net

Given:
fetchMock.postOnce('path:/2/account/check/subdomain', { query: 'foo', available: false });
and doing
console.log(fetchMock.calls());
I get...

      [
        'https://api.whenidev.net/2/account/check/subdomain?q=foo',
        { query: [Object], method: 'GET', headers: [Object] },
        request: undefined,
        identifier: 'path:/2/account/check/subdomain',
        isUnmatched: undefined,
        response: undefined
      ]
    ]

I've also attempted mocking it like so...

fetchMock.postOnce('path:/2/account/check/subdomain', { body: { query: 'foo', available: false } });
and same result, it's always undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant