You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a mock for an express-style path (e.g. express:/example/:foo/:bar, there is no built-in way to access the parsed values for foo and bar:
const mockedEndpoint = (url, opts) => {
// we should be able to use { foo: <whatever>, bar: <whatever> } here without additional parsing
};
fetchMock.get('express:/example/:foo/:bar', mockedEndpoint);
fetch('/example/foovalue/barvalue'); // we would have access to { foo: 'foovalue', bar: 'barvalue' } in mockedEndpoint
We're giving fetchMock.get enough information (the matching express-style pattern and the URL itself) that it should be able to parse out what foo and bar are and pass them to the callback (potentially as a third argument?).
This issue was called out in #300 but either wasn't addressed at all or was addressed but in a too-opaque-for-me-to-understand way.
The text was updated successfully, but these errors were encountered:
When adding a mock for an
express
-style path (e.g.express:/example/:foo/:bar
, there is no built-in way to access the parsed values forfoo
andbar
:We're giving
fetchMock.get
enough information (the matchingexpress
-style pattern and the URL itself) that it should be able to parse out whatfoo
andbar
are and pass them to the callback (potentially as a third argument?).This issue was called out in #300 but either wasn't addressed at all or was addressed but in a too-opaque-for-me-to-understand way.
The text was updated successfully, but these errors were encountered: