The following mock will never work since the query strings are removed from the original URL but not from the handler URL:
rest.get("/foo?bar=10", (req, res, ctx) => {
return res(
ctx.json({
foo: "bar",
})
);
}),
msw: 0.19.0nodejs: 12.17.0npm: 6.14.4Steps to reproduce the behavior:
/foo?bar=10There should be an warning explaining why the mock won't work and how to fix the problem
Hey, @rafaelalmeidatk! Nice to see you here! Thanks for bringing this in a form of an issue. The usage of query parameters in request handlers URLs should be discouraged and a warning message would help tremendously.
I'll try to plan and do this in the nearest future. Just in case you'd be interested in shipping a pull request with this, I'll always support you in code review to make this change awesome.
Most helpful comment
Hey, @rafaelalmeidatk! Nice to see you here! Thanks for bringing this in a form of an issue. The usage of query parameters in request handlers URLs should be discouraged and a warning message would help tremendously.
I'll try to plan and do this in the nearest future. Just in case you'd be interested in shipping a pull request with this, I'll always support you in code review to make this change awesome.