Mirage passthrough


#1

Hi,

I’m new to ember and I can’t seem to get mirage passthrough to work. I’m sure it’s something really basic that I’m missing.

I have created a simple ember app at https://github.com/robwatkin/mirg to highlight my problem and raised an issue at https://github.com/samselikoff/ember-cli-mirage/issues/449 which I’ll paste below.

Any help or comments at all would be really appreciated as I’ve been totally stuck on this for a couple of days.

Thanks Rob

Issue #449

I have created a very simple ember app with http-mock for one simple GET endpoint. I can get mirage to return data from a handler in config.js

mirage/config.js

this.get('/api/foofs', function() {
return {

  'foofs': [
    { id: 1, name: 'foo a'},
    { id: 2, name: 'foo b'},
    { id: 3, name: 'foo c'}
  ]
};

However, when I replace this with a passthrough

this.passthrough('/api/foofs');

ember just seems to hang, browser is empty and console says:

DEBUG: -------------------------------
DEBUG: Ember      : 1.13.11
DEBUG: Ember Data : 1.13.15
DEBUG: jQuery     : 1.11.3
DEBUG: -------------------------------
XHR finished loading: GET "http://localhost:4200/api/foofs".

#2

Are you trying to use the http mocks that are built in with Ember-CLI? If memory serves, Mirage disabled those when it starts up …


#3

I have now resolved the issued thanks to help on Github which simply required forcing jQuery to 2.x in bower.json.

Although the mirg project which I built to highlight the issue did use http-mocks our main code base does not and that’s where the issue was first noticed.