admin管理员组文章数量:1426458
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.
本文标签: javascriptMirage passthrough is not workingStack Overflow
版权声明:本文标题:javascript - Mirage `passthrough` is not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745412729a2657542.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论