Subclass Http2Stream and be able to pass it into createSecureServer function? #4980
Unanswered
ballantyne
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/nodejs/node/blob/a7e5b413efd5f98d4b9acf39ff5e87ddbd8c63ff/src/node_http2.cc#L1873
I am having a look around and I am trying to see if there is a way to subclass the Http2Stream or ServerHttp2Stream class so that I can overwrite and change how if works a little bit. In the previous http and https modules you can set headers and pass them along with the req, res objects but I don't see a way to do something similar that will set the headers when you call stream.respond. Am I missing something that is obvious? I am trying to find a way where if headers are set in the middleware of a framework somewhere then will be sent when the user calls respond or writes to the stream or something. I am unable to find a way to do that that works the way I am hoping. I was thinking about overwriting the respond function in a subclass of Http2Stream so that it looks at this.headers and combines the headers with the headers that are passed in, but I don't see a way to customize that class. Is that possible? Is there another way that you think would work better?
https://nodejs.org/dist/latest-v18.x/docs/api/http2.html#class-http2stream
https://nodejs.org/dist/latest-v18.x/docs/api/http2.html#class-serverhttp2stream
This is the class in the docs. I'm sure you are familiar. Just thought I would also post this for other people that might read this so they have easy access to other relevant information.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions