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

Returning different values for different requests on the same URL #637

Open
julienw opened this issue Apr 28, 2022 · 0 comments
Open

Returning different values for different requests on the same URL #637

julienw opened this issue Apr 28, 2022 · 0 comments

Comments

@julienw
Copy link

julienw commented Apr 28, 2022

Hi,

I'd like to do something like this:

  1. First request to : 404
  2. Second request to : actual result

So I tried this:

      fetch
        .getOnce(expectedUrl, 404)
        .get(expectedUrl, result);

But this throws because of Adding route with same name or matcher as existing route. See overwriteRoutes option.
It's not super clear which values of overwriteRoutes would work, so I tried first with true then false.

Finally this works:

      fetch
        .getOnce(expectedUrl, 404)
        .get(expectedUrl, result, {
          overwriteRoutes: false,
        });

But I wonder how this could be improved. Maybe this could be a default? Or some guide in the documentation?

Thanks!

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