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

HTTP2 sample no working #807

Open
branaway opened this issue Dec 28, 2022 · 0 comments
Open

HTTP2 sample no working #807

branaway opened this issue Dec 28, 2022 · 0 comments
Labels

Comments

@branaway
Copy link

With the latest npm module, the sample code for HTTP2 did not work:

import request from 'supertest';
import express from 'express';

const app = express();

app.get( '/user', function( req, res ) {
res.status( 200 ).json( { name: 'john' } );
} );

request( app, { http2: true } )
.get( '/user' )
.expect( 'Content-Type', /json/ )
.expect( 'Content-Length', '15' )
.expect( 200 )
.end( function( err, res ) {
if ( err ) throw err;
} );

request.agent( app, { http2: true } )
.get( '/user' )
.expect( 'Content-Type', /json/ )
.expect( 'Content-Length', '15' )
.expect( 200 )
.end( function( err, res ) {
if ( err ) throw err;
} );

This is what I saw by running the above piece of code:

➜ ~/localProjects/umxverse git:(test) ✗ node '/Users/bran/localProjects/umxverse/supertesty.js'
node:events:491
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'readable')
at IncomingMessage.read (node:http_incoming:214:19)
at Readable.read (node:internal/streams/readable:496:12)
at resume
(node:internal/streams/readable:999:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on IncomingMessage instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at errorOrDestroy (node:internal/streams/destroy:214:7)
at Readable.read (node:internal/streams/readable:498:7)
at resume
(node:internal/streams/readable:999:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.11.0

@branaway branaway added the bug label Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant