question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.onAny() not working as expected

See original GitHub issue

I have my mocks set up like to:

mock
  .onGet('/foo').reply(200)
  .onAny().reply(500);

However, when I make a request to /bar, a 404 code is returned instead of my specified 500. Changing this to .onAny('/bar') or .onAny(/.*/) works as expected.

I am using axios v0.14.0 and axios-mock-adapter v1.6.1.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ctimmermcommented, Oct 24, 2016

OK, thanks for the explanation, now I get it. I’ll fix it

1reaction
ctimmermcommented, Oct 18, 2016

Yeah, the feature was included with some other, larger changes. I’ll update the release notes to mention it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Response for "onAny().passthrough()" always returns ... - GitHub
onAny().passThrough(). The mocked (/mocked) endpoint works as expected, but I never get any response data back for any of the real API ...
Read more >
Regex replace not working as intended on any browser ...
I'm trying to create a function which adds a styled span element around a regex match to create text highlighting within a code...
Read more >
Best practices for writing unit tests - .NET - Microsoft Learn
When you have a suite of well-named unit tests, each test should be able to clearly explain the expected output for a given...
Read more >
If an app on your iPhone or iPad stops responding, closes ...
Then open the app to see if it's working as expected. Check for updates. To see if updates are available for the app,...
Read more >
Promise.reject() - JavaScript - MDN Web Docs
The Promise.reject() method returns a Promise object that is rejected with a ... Report problems with this compatibility data on GitHub ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found