Adds HTTP trailers (headers but at the end of the message) to the message.
Trailers will only be emitted if the message is chunked encoded. If not, the trailers will be silently discarded.
HTTP requires the Trailer header to be sent to emit trailers, with a list of header field names in its value, e.g.
Trailer
message.writeHead(200, { 'Content-Type': 'text/plain', 'Trailer': 'Content-MD5' });message.write(fileData);message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });message.end(); Copy
message.writeHead(200, { 'Content-Type': 'text/plain', 'Trailer': 'Content-MD5' });message.write(fileData);message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });message.end();
Attempting to set a header field name or value that contains invalid characters will result in a TypeError being thrown.
TypeError
v0.3.0
Adds HTTP trailers (headers but at the end of the message) to the message.
Trailers will only be emitted if the message is chunked encoded. If not, the trailers will be silently discarded.
HTTP requires the
Trailer
header to be sent to emit trailers, with a list of header field names in its value, e.g.Attempting to set a header field name or value that contains invalid characters will result in a
TypeError
being thrown.