Comments (18)
Is this still being considered? For me this is the only reason not to use Mirage because I consume multiple API's on different domains.
from ember-cli-mirage.
looks like it's getting added to pretender! pretenderjs/pretender#66
from ember-cli-mirage.
And it has landed in Pretender 0.8.0
from ember-cli-mirage.
@samselikoff Any pointers on where you'd like to get started on this? I've got a client who needs it, so may be able to help push this in the right direction tomorrow ...
from ember-cli-mirage.
@acorncom: You might be able to get it to work without any changes in ember-cli-mirage. In app/mirage/config.js
, try setting this.namespace
to your API endpoint hostname and path. For us that looks something like:
this.namespace = config.api.host + '/' + config.api.namespace;
from ember-cli-mirage.
@theazureshadow Sadly, that doesn't work. What I'm trying to do is build a prototype backed by Ember-CLI-Mirage that uses Algolia for searching. I either need a way to mock responses from Algolia for non-acceptance tests (I can do it for acceptance tests) or a way to poke a hole clean through Mirage so I can actually talk to Algolia. Things work smoothly if I turn off Mirage altogether, but then the rest of my prototype doesn't work (no data ;-)
I'm getting this error:
Pretender will not respond to requests for URLs. It is not possible to accurately simluate the browser's CSP. Remove the http://<app-id>-dsn.algolia.net from http://<app-id>-dsn.algolia.net/1/indexes/*/queries
from ember-cli-mirage.
are you sure you updated Pretender? That error message doesn't exist in 0.9.
To poke a hole in Mirage add
this.pretender.get('/*passthrough', this.pretender.passthrough);
to the bottom of your mirage/config.js
.
from ember-cli-mirage.
@samselikoff Yes, sadly, I've tried that exact line of code for poking a hole in Mirage. Actually, more accurately, I've tried the following:
this.pretender.get('/1/index*', this.pretender.passthrough);
within the app/mirage/config
function that is exported. And I've tried it with pretender 0.6.0, 0.7.0 and 0.9.0. With 0.9.0 the error I'm getting is:
Mirage: Your Ember app tried to POST 'http://<app-id>-dsn.algolia.net/1/indexes/*/queries', but there was no route defined to handle this request. Define a route that matches this path in your mirage/config.js file.
but it's still approximately the same. I've dug in deep a few times and seem to be getting snagged on the host registry combined with an absolute URL (which Algolia's search client requires).
I've been quietly beating my head against a wall, hoping that the upgrade to pretender would magically fix everything ;-) When it didn't, I thought I'd better ask a few more questions ...
from ember-cli-mirage.
@acorncom as for mocking xhrs at Algolia we built https://github.com/algolia/faux-jax maybe have a look
from ember-cli-mirage.
Sorry, sounds v frustrating @acorncom. I should have time to take a look at this soon.
from ember-cli-mirage.
Ah looks like you're POST'ing, try this
this.pretender.get('/1/index*', this.pretender.passthrough);
this.pretender.post('/1/index*', this.pretender.passthrough);
this.pretender.put('/1/index*', this.pretender.passthrough);
this.pretender.delete('/1/index*', this.pretender.passthrough);
or like I said use /*passthrough
for the route and put that at the bottom of your config.js
to have all non-handled requests pass through.
from ember-cli-mirage.
Looks like you need to be on jQuery 2.x as well
from ember-cli-mirage.
@samselikoff Appreciate your help on it. We've been using jQuery 1.x, so that may be the issue. I'll be in touch once I've had a chance to test.
Re: frustrating. Time-consuming at the least ;-) I definitely know far more about the internals of Mirage and Pretender than I did before, let's put it that way ;-)
from ember-cli-mirage.
@samselikoff Looks like upgrading to jQuery 2.x isn't helping on my end. Am I wasting too much of your time here? Should I open a new issue? I'd be happy to post a reproduction repo if you are inclined to help, but don't want to presume ... Thanks!
from ember-cli-mirage.
@acorncom are you sure that you're depending on pretender 0.9? It looks like we forgot to update this package's blueprint to install pretender 0.9.
from ember-cli-mirage.
I'm pretty sure this is possible. I created a sample repo with this working. @acorncom if you can post an app where this is reproducible, that would be great.
from ember-cli-mirage.
@blimmer Appreciate your sample repo. I'll open a separate issue, as this may be a misconfiguration on my part (don't think so though ...)
from ember-cli-mirage.
Passthrough api has landed, if anyone here still needs help please comment.
http://www.ember-cli-mirage.com/docs/v0.1.x/manually-starting-mirage/
Thanks!
from ember-cli-mirage.
Related Issues (20)
- Proposal to change of Mirage Setup HOT 4
- Remove autostart HOT 7
- Remove the testConfig function HOT 5
- Consider making MirageJS a peer dependency HOT 12
- Mirage not intercepting requests HOT 1
- discoverEmberDataModels() triggers `ember-data:deprecate-early-static` deprecation HOT 4
- What this addon does now that MirageJS has been extracted HOT 4
- v3 upgrade guide? HOT 1
- Timing not working in miragejs server instance HOT 1
- breaks when using ember-data 4.8.0 HOT 15
- Extending a model breaks one-to-many relationship
- Mirage cannot preload assets HOT 2
- New Release? HOT 14
- discoverEmberDataModels() fails if any pre Octane style Ember model has a property named `errors` HOT 1
- Tests only? HOT 9
- Is it possible to have a custom folder for fixtures in mirage? HOT 2
- Accessing Models using `require()` will no longer work on ember-data v5 HOT 1
- `discoverEmberDataModels` crashes if there is a non ember-data object in the app/models folder HOT 6
- mirage enabled even when using `--proxy` flag HOT 5
- Polymorphics - missing the buid method HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-cli-mirage.