Fix createUnbufferedStream() function call

In 49a21155f642670dfea264ac73fb60241f37cb87, I managed to incorrectly
write the `createUnbufferedStream()` function from the AWS SDK as
`getUnbufferedStream()` and to consistently use that naming in the unit
tests.

This commit fixes that. I have tested again on S3.
This commit is contained in:
Eric Mc Sween 2019-06-19 12:58:17 -04:00
parent cbe32ba1b9
commit 7d900b57bf
2 changed files with 3 additions and 3 deletions

View file

@ -102,7 +102,7 @@ module.exports =
if statusCode not in [200, 206] if statusCode not in [200, 206]
logger.log({bucketName: bucketName, key: key }, "error getting file from s3: #{statusCode}") logger.log({bucketName: bucketName, key: key }, "error getting file from s3: #{statusCode}")
return callback(new Error("Got non-200 response from S3: #{statusCode} #{statusMessage}"), null) return callback(new Error("Got non-200 response from S3: #{statusCode} #{statusMessage}"), null)
stream = response.httpResponse.getUnbufferedStream() stream = response.httpResponse.createUnbufferedStream()
callback(null, stream) callback(null, stream)
request.on 'error', (err) => request.on 'error', (err) =>

View file

@ -32,7 +32,7 @@ describe "S3PersistorManagerTests", ->
send: sinon.stub() send: sinon.stub()
@s3Response = @s3Response =
httpResponse: httpResponse:
getUnbufferedStream: sinon.stub() createUnbufferedStream: sinon.stub()
@s3Client = @s3Client =
copyObject: sinon.stub() copyObject: sinon.stub()
headObject: sinon.stub() headObject: sinon.stub()
@ -64,7 +64,7 @@ describe "S3PersistorManagerTests", ->
@expectedStream = { expectedStream: true } @expectedStream = { expectedStream: true }
@s3Request.send.callsFake () => @s3Request.send.callsFake () =>
@s3EventHandlers.httpHeaders(200, {}, @s3Response, "OK") @s3EventHandlers.httpHeaders(200, {}, @s3Response, "OK")
@s3Response.httpResponse.getUnbufferedStream.returns(@expectedStream) @s3Response.httpResponse.createUnbufferedStream.returns(@expectedStream)
it "returns a stream", (done) -> it "returns a stream", (done) ->
@S3PersistorManager.getFileStream @bucketName, @key, {}, (err, stream) => @S3PersistorManager.getFileStream @bucketName, @key, {}, (err, stream) =>