hisco / http2-client

Transparently make http request to both http1 / http2 server.
https://www.npmjs.com/package/http2-client
MIT License
33 stars 14 forks source link

Cannot create custom HttpRequestManager #17

Open jellelute opened 5 years ago

jellelute commented 5 years ago

Hi,

Thanks for the library. I would like to make use of the HttpRequestManager to be able to reuse the connection. I'm following the exact code example:

const {HttpRequestManager} = require('http2-client'); const httpRequestManager = new HttpRequestManager();

and i'm getting this error: TypeError: HttpRequestManager is not a constructor I'm tried using nodejs12 and nodejs10. I use typescript and i'm compiling to ES6, but also tried ES2018. Did you export this class?

hisco commented 5 years ago

Hey,

It's not exported by "main" this is why you cannot require it. You could be using:

const {HttpRequestManager} = require('http2-client/lib/request');

Although it's not recommended using something that is not exported... Please let me know if it works for you and why you need it.. and I may export it in next version..

jellelute commented 5 years ago

Hey hisco,

Thanks, this will work for me!