Skip to content

Commit

Permalink
fix(deps): Bumped get-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
grantila committed Mar 12, 2019
1 parent 9747412 commit bbcc0b4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
8 changes: 4 additions & 4 deletions lib/body.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createHash } from "crypto";

import { tap } from "already";
import { buffer as getStreamAsBuffer } from "get-stream";
import getStream from "get-stream";
import * as through2 from "through2";
import * as toArrayBuffer from "to-arraybuffer";

Expand Down Expand Up @@ -69,7 +69,7 @@ export class Body implements IBody
return this.validateIntegrity( emptyBuffer, allowIncomplete );

else if ( isStream( this._body ) )
return getStreamAsBuffer( < NodeJS.ReadableStream >this._body )
return getStream.buffer( < NodeJS.ReadableStream >this._body )
.then( buffer =>
this.validateIntegrity( buffer, allowIncomplete )
)
Expand Down Expand Up @@ -100,7 +100,7 @@ export class Body implements IBody
)
.then( ( ) => this._body );
else if ( isStream( this._body ) )
return getStreamAsBuffer( < NodeJS.ReadableStream >this._body )
return getStream.buffer( < NodeJS.ReadableStream >this._body )
.then( tap( buffer =>
< any >this.validateIntegrity( buffer, false )
) )
Expand All @@ -125,7 +125,7 @@ export class Body implements IBody
)
.then( ( ) => < string >< BodyTypes >this._body );
else if ( isStream( this._body ) )
return getStreamAsBuffer( < NodeJS.ReadableStream >this._body )
return getStream.buffer( < NodeJS.ReadableStream >this._body )
.then( tap( buffer =>
< any >this.validateIntegrity( buffer, allowIncomplete )
) )
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"@types/chai": "4.x",
"@types/execa": "0.x",
"@types/from2": "2.x",
"@types/get-stream": "3.x",
"@types/mocha": "5.x",
"@types/node": "11.x",
"@types/through2": "2.x",
Expand All @@ -79,7 +78,7 @@
"@types/tough-cookie": "2.x",
"already": "1.x",
"callguard": "1.x",
"get-stream": "4.x",
"get-stream": "5.x",
"through2": "3.x",
"to-arraybuffer": "1.x",
"tough-cookie": "3.x"
Expand Down
10 changes: 5 additions & 5 deletions test/fetch-h2/body.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from "chai";
import { createHash } from "crypto";
import { buffer as getStreamAsBuffer } from "get-stream";
import getStream from "get-stream";
import "mocha";
import * as through2 from "through2";

Expand Down Expand Up @@ -499,21 +499,21 @@ describe( "body", ( ) =>
it( "handle null", async ( ) =>
{
const body = new DataBody( null );
const data = await getStreamAsBuffer( await body.readable( ) );
const data = await getStream.buffer( await body.readable( ) );
expect( data.toString( ) ).to.equal( "" );
} );

it( "handle string", async ( ) =>
{
const body = new DataBody( "foo" );
const data = await getStreamAsBuffer( await body.readable( ) );
const data = await getStream.buffer( await body.readable( ) );
expect( data.toString( ) ).to.equal( "foo" );
} );

it( "handle buffer", async ( ) =>
{
const body = new DataBody( Buffer.from( "foo" ) );
const data = await getStreamAsBuffer( await body.readable( ) );
const data = await getStream.buffer( await body.readable( ) );
expect( data.toString( ) ).to.equal( "foo" );
} );

Expand All @@ -522,7 +522,7 @@ describe( "body", ( ) =>
const stream = through2( );
stream.end( "foo" );
const body = new StreamBody( stream );
const data = await getStreamAsBuffer( await body.readable( ) );
const data = await getStream.buffer( await body.readable( ) );
expect( data.toString( ) ).to.equal( "foo" );
} );
} );
Expand Down
8 changes: 4 additions & 4 deletions test/fetch-h2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defer, delay } from "already";
import { expect } from "chai";
import { createHash } from "crypto";
import * as from2 from "from2";
import { buffer as getStreamAsBuffer } from "get-stream";
import getStream from "get-stream";
import "mocha";
import * as through2 from "through2";

Expand Down Expand Up @@ -611,7 +611,7 @@ describe( `(${version} over ${proto.replace( ":", "" )})`, ( ) =>

const stream = await response.readable( );

const data = await getStreamAsBuffer( stream );
const data = await getStream.buffer( stream );

expect( JSON.parse( data.toString( ) ) ).to.deep.equal( testData );

Expand Down Expand Up @@ -639,7 +639,7 @@ describe( `(${version} over ${proto.replace( ":", "" )})`, ( ) =>

const stream = await response.readable( );

const data = await getStreamAsBuffer( stream );
const data = await getStream.buffer( stream );

expect( JSON.parse( data.toString( ) ) ).to.deep.equal( testData );

Expand Down Expand Up @@ -669,7 +669,7 @@ describe( `(${version} over ${proto.replace( ":", "" )})`, ( ) =>

const stream = await response.readable( );

const data = await getStreamAsBuffer( stream );
const data = await getStream.buffer( stream );

expect( JSON.parse( data.toString( ) ) ).to.deep.equal( testData );

Expand Down
6 changes: 3 additions & 3 deletions test/lib/server-http1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { createHash } from "crypto";
import { createBrotliCompress, createDeflate, createGzip } from "zlib";

import { delay } from "already";
import { buffer as getStreamAsBuffer } from "get-stream";
import getStream from "get-stream";

import {
ignoreError,
Expand Down Expand Up @@ -135,7 +135,7 @@ export class ServerHttp1 extends TypedServer< HttpServer | HttpsServer >
[ HTTP2_HEADER_SET_COOKIE ]: [ ],
};

const data = await getStreamAsBuffer( request );
const data = await getStream.buffer( request );
const json = JSON.parse( data.toString( ) );
json.forEach( ( cookie: any ) =>
{
Expand Down Expand Up @@ -179,7 +179,7 @@ export class ServerHttp1 extends TypedServer< HttpServer | HttpsServer >
":status": 200,
};

const data = await getStreamAsBuffer( request );
const data = await getStream.buffer( request );
const json = JSON.parse( data.toString( ) );

sendHeaders( responseHeaders );
Expand Down
8 changes: 4 additions & 4 deletions test/lib/server-http2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { createHash } from "crypto";
import { createBrotliCompress, createDeflate, createGzip } from "zlib";

import { delay } from "already";
import { buffer as getStreamAsBuffer } from "get-stream";
import getStream from "get-stream";

import {
ignoreError,
Expand Down Expand Up @@ -109,7 +109,7 @@ export class ServerHttp2 extends TypedServer< Http2Server >
[ HTTP2_HEADER_SET_COOKIE ]: [ ],
};

const data = await getStreamAsBuffer( stream );
const data = await getStream.buffer( stream );
const json = JSON.parse( data.toString( ) );
json.forEach( ( cookie: any ) =>
{
Expand Down Expand Up @@ -151,7 +151,7 @@ export class ServerHttp2 extends TypedServer< Http2Server >
":status": 200,
};

const data = await getStreamAsBuffer( stream );
const data = await getStream.buffer( stream );
const json = JSON.parse( data.toString( ) );

stream.once( "wantTrailers", ( ) =>
Expand Down Expand Up @@ -199,7 +199,7 @@ export class ServerHttp2 extends TypedServer< Http2Server >
":status": 200,
};

const data = await getStreamAsBuffer( stream );
const data = await getStream.buffer( stream );
const json = JSON.parse( data.toString( ) );

json.forEach( ( pushable: any ) =>
Expand Down

0 comments on commit bbcc0b4

Please sign in to comment.