Node provides this method:
http2stream.additionalHeaders(headers)
Which Sends an additional informational HEADERS frame to the connected HTTP/2 peer.
However the node codebase contains this comment:
// Sends a block of informational headers. In theory, the HTTP/2 spec
// allows sending a HEADER block at any time during a streams lifecycle,
// but the HTTP request/response semantics defined in HTTP/2 places limits
// such that HEADERS may only be sent *before* or *after* DATA frames.
// If the block of headers being sent includes a status code, it MUST be
// a 1xx informational code and it MUST be sent before the request/response
// headers are sent, or an error will be thrown.
Is it possible to send subsequent or additional HEADER blocks on a stream?
e.g. pseudo code:
stream.respond(HEADER)
stream.write(DATA)
stream.additionalHeaders(HEADER)
stream.write(DATA)
stream.end(DATA)
And:
if possible please provide some demo code; or
if not what is the point of the
additionalHeaders
function, and as theresponse
event returns the header what is point of theheaders
event?