algolia / faux-jax

NO MORE MAINTAINED: Intercept and respond to requests in the browser (AJAX) and Node.js (http(s) module)
MIT License
95 stars 10 forks source link

ECONNRESET #11

Closed srph closed 8 years ago

srph commented 8 years ago

I get this error { [Error: socket hang up] code: 'ECONNRESET' }, as I ran faux-jax.

Here's my code:

var expect = require('chai').expect;
var faux = require('faux-jax');
var axios = require('axios');

describe('axios-base-url interceptor', function() {
  it('should not append the base-url if request url is absolute', function(done) {
    faux.install();
    axios.get('http://swag.com/hehe').then(done, done);

    faux.on('request', function(request) {
      request.respond(200, { 'Content-Type': 'text/plain' }, '');
      faux.restore();
    });
  });
});

I'm not sure if this is related to axios as it simply uses http when in node under the hood.

Demo

Check out this repo

vvo commented 8 years ago

Thanks for the bug report, should be better now, let me now (upgrade to v4.2.2)