I'm trying to use passthrough for a POST request in this Ember project
this.passthrough('/thirdeye/entity?entityType=ANOMALY_FUNCTION');
This is what the call looks like in app/mirage/config.js
.
I got the following error:
Mirage: Your Ember app tried to POST '/thirdeye/entity?entityType=ANOMALY_FUNCTION',
but there was no route defined to handle this request.
Define a route that matches this path in your
mirage/config.js file. Did you forget to add your namespace?
Clearly, I've added that call to the config file, but it's not being picked up. I read that passthrough
only works for >= jquery 2.x
, which my project is.
Does anyone know what else could cause this?
I'm trying to use passthrough for a POST request in this Ember project
this.passthrough('/thirdeye/entity?entityType=ANOMALY_FUNCTION');
This is what the call looks like in app/mirage/config.js
.
I got the following error:
Mirage: Your Ember app tried to POST '/thirdeye/entity?entityType=ANOMALY_FUNCTION',
but there was no route defined to handle this request.
Define a route that matches this path in your
mirage/config.js file. Did you forget to add your namespace?
Clearly, I've added that call to the config file, but it's not being picked up. I read that passthrough
only works for >= jquery 2.x
, which my project is.
Does anyone know what else could cause this?
Share Improve this question asked Oct 30, 2017 at 22:46 johnwjjohnwj 4491 gold badge8 silver badges16 bronze badges2 Answers
Reset to default 5I found out the problem was I had to do this.passthrough('/thirdeye/***');
since the call has query params. It works now.
I couldn't get passthrough working at all, the examples I saw for external URLs were just being ignored and the responses on Github were a bit vague. In the end I was able to use the function override for it to whitelist patterns matches:
this.passthrough(request =>
[
/amazon/
].some((regex) => regex.test(request.url)));
i.e. anything with amazon
in the URL is ignored.
Note, include at the end of the routes
function.