spdy-http2 / node-spdy

SPDY server on Node.js
2.81k stars 196 forks source link

spdy custom agent does not work with nock #211

Closed goloroden closed 9 years ago

goloroden commented 9 years ago

I don't know whether the problem is nock or spdy (or both), hence I'm adding it as an issue here, too: Basically, my problem is that nock works unless I use a custom agent created using spdy module.

The details, including a test case to reproduce the issue can be found here: https://github.com/pgte/nock/issues/356

goloroden commented 9 years ago

Okay … I found the issue: Instead of

var agent = spdy.createAgent({
  host: 'localhost',
  port: 3000
});

it should be:

var agent = spdy.createAgent({
  host: 'localhost',
  port: 3000
}).once('error', function (err) {
  this.emit(err);
});

Then everything works as expected. Maybe it could be an idea to add this as a hint to the documentation?

indutny commented 9 years ago

@goloroden nice! I'm up for changes to the readme. Are you interested in sending a PR?

goloroden commented 9 years ago

I'll come up with one :-)

Just give me a little time…

goloroden commented 9 years ago

I've sent a PR.

The build fails, but since I only updated the README.md file I guess the build already failed before ;-)

indutny commented 9 years ago

Thank you!

goloroden commented 9 years ago

You're welcome :-)

Since things are documented now, I'm closing this issue :-)