mardi 1 octobre 2019

Ember.js ajax POST request not going through mirage

I am writing some tests for a component in my Ember application, where the component performs an ajax POST request to my servers API that will return a string of the location of a file.

I have added in the mirage/config.js file a route that should be used when the ajax request is performed.

  this.post('/foobar', () => {
    return "test";
  });

When I run my tests, I can see in the network tab and console that the ajax request is attempting to be performed on my localhost, but is getting a Connection Refused error.

POST http://localhost:8000/foobar net::ERR_CONNECTION_REFUSED.

When putting a debugger in the mirage/config.js file, it is not stopping there and it seems to be ignoring the route in my mirage/config.js entirely.

The URL and namespace are all set up in the config file.

What can I do to test further and find out why the request is not going through mirage?




Aucun commentaire:

Enregistrer un commentaire