How to use the already.delay function in already

To help you get started, we’ve selected a few already examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github grantila / fetch-h2 / test / fetch-h2 / index.ts View on Github external
it( 'should be possible to POST not yet ended stream-data', async ( ) =>
	{
		const stream = through2( );

		const eventual_response = fetch(
			'https://nghttp2.org/httpbin/post',
			{
				method: 'POST',
				body: new StreamBody( stream ),
				headers: { 'content-length': '6' },
			}
		);

		await delay( 1 );

		stream.write( "foo" );
		stream.write( "bar" );
		stream.end( );

		const response = await eventual_response;

		const data = await response.json( );
		expect( data.data ).to.equal( "foobar" );
	} );
github grantila / fetch-h2 / test / fetch-h2 / httpbin.ts View on Github external
wrapContext( async ( fetch ) =>
	{
		const stream = through2( );

		const eventualResponse = fetch(
			`${host}/post`,
			{
				allowForbiddenHeaders: true,
				body: new StreamBody( stream ),
				headers: { "content-length": "6" },
				method: "POST",
			}
		);

		await delay( 1 );

		stream.write( "foo" );
		stream.write( "bar" );
		stream.end( );

		const response = await eventualResponse;

		const data = await response.json( );
		expect( data.data ).toBe( "foobar" );
	} ) );

already

Promise extensions; map, filter, etc

MIT
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis