Skip to content

Commit

Permalink
zlib.gzipSync() -> zlib.gzip(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewandennis committed Feb 22, 2016
1 parent 5294872 commit d3c8e0e
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions test/spec/sparkpost.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,17 @@ describe('SparkPost Library', function() {

it('should accept gzipped responses', function(done) {
var TEST_MESSAGE = 'This is a compressible test and it is full of compressible test stuff.'
, compressedMsg = zlib.gzipSync(TEST_MESSAGE + TEST_MESSAGE)
, gzipNock = nock('https://test.sparkpost.com', {
, compressedMsg
, gzipNock
, options = {
method: 'GET'
, uri: 'https://test.sparkpost.com/test'
};

zlib.gzip(TEST_MESSAGE+TEST_MESSAGE, function(err, gzipped) {
expect(err).to.be.null;
compressedMsg = gzipped;
gzipNock = nock('https://test.sparkpost.com', {
reqheaders: {
'accept-encoding': 'gzip'
}
Expand All @@ -180,19 +189,15 @@ describe('SparkPost Library', function() {
'X-Transfer-Length': String(compressedMsg.length)
, 'Content-Length': undefined
, 'Content-Encoding': 'gzip'
})
, options = {
method: 'GET'
, uri: 'https://test.sparkpost.com/test'
};

client.request(options, function(err, data) {
expect(err).to.be.null;
expect(data.statusCode).to.equal(200);
expect(data.body).to.equal(TEST_MESSAGE + TEST_MESSAGE);
});
client.request(options, function(err, data) {
expect(err).to.be.null;
expect(data.statusCode).to.equal(200);
expect(data.body).to.equal(TEST_MESSAGE + TEST_MESSAGE);

// finish async test
done();
// finish async test
done();
});
});
});

Expand Down

0 comments on commit d3c8e0e

Please sign in to comment.