Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen for decompressor error events #172

Merged
merged 4 commits into from Jun 15, 2016

Conversation

jasonwilson
Copy link
Contributor

Noticed a malformed server response was causing uncaught errors in the client response pipeline. Small fix to register error handler on the decompressor stream and accompanying test.

@tomas
Copy link
Owner

tomas commented May 2, 2016

Good catch! Thanks.


it('should rethrow errors from decompressors', function(done){
needle.get('localhost:' + port, {headers: {'Accept-Encoding': 'deflate', 'With-Bad': 'true'}}, function(err, response, body){
should.exist(err);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also test for the type of error we're expecting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the test to check the error code and message.

@tomas tomas merged commit 80b3ae8 into tomas:master Jun 15, 2016
@tomas tomas mentioned this pull request Jun 15, 2016
@tomas
Copy link
Owner

tomas commented Jun 15, 2016

Which version of node did you test against? I'm using v4.4.6 and the last spec within compression_spec is not passing:

  compression
    when server supports compression
      and client requests no compression
        ✓ should have the body decompressed 
      and client requests gzip compression
        ✓ should have the body decompressed 
      and client requests deflate compression
        ✓ should have the body decompressed 
        1) should rethrow errors from decompressors


  3 passing (62ms)
  1 failing

  1) compression when server supports compression and client requests deflate compression should rethrow errors from decompressors:
     Uncaught AssertionError: expected null to exist
      at /home/tomas/code/packages/js/needle/test/compression_spec.js:85:18
      at done (/home/tomas/code/packages/js/needle/lib/needle.js:382:14)
      at PassThrough.<anonymous> (/home/tomas/code/packages/js/needle/lib/needle.js:586:9)
      at emitNone (events.js:72:20)

@jasonwilson
Copy link
Contributor Author

Was using 5.x. I see that you merged anyway was it a transient issue?

@tomas
Copy link
Owner

tomas commented Jun 15, 2016

I tested before but I think I might have been using a different version. Would you be able to take a look at this under 4.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants