forwardemail / forwardemail/superagent

superagent.post - Error: connect ECONNREFUSED 127.0.0.1:8080

Open
#1,538 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I updated the version of superagent with **0.1.x to 5.x.x** but not sure why I am getting this error in my `catch` block.

```
{ Error: connect ECONNREFUSED 127.0.0.1:8080
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8080,
response: undefined }
```

```
superagent.post(host_url+'/api/v2/users')
.send({ first_name: 'test',
email: email,
last_name:'Test',
password:"test",
password2:"test",
company: 'test',
is_registeration: true,
organisation: crypto.randomBytes(18).toString('hex')
})
.then(function(error, res){
expect(error).to.eql(null);
expect(res).to.exist;
expect(res.status).to.equal(200);
admin_id = res.body._id;
organisation_id = res.body.organisation;
res.body.should.have.property('personal_email', email.toLowerCase());
done();
})
.catch(function (error) {
console.log(error);
});
````
I am not sure if I am doing anything wrong I just replace `.end` to `.then` and added the `.catch` block.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.