response.addTrailers(headers)
添加於:v0.3.0
參數
headers
<Object>
此方法將 HTTP 尾隨標頭(標頭但位於消息末尾)添加到響應中。
隻有在對響應使用分塊編碼時才會發出預告片;如果不是(例如,如果請求是 HTTP/1.0),它們將被靜默丟棄。
HTTP 要求發送 Trailer
標頭以發出預告片,並在其值中包含標頭字段列表。例如:,
response.writeHead(200, { 'Content-Type': 'text/plain',
'Trailer': 'Content-MD5' });
response.write(fileData);
response.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
response.end();
嘗試設置包含無效字符的標頭字段名稱或值將導致引發
。TypeError
相關用法
- Node.js response.addTrailers()用法及代碼示例
- Node.js http.ServerResponse response.statusCode用法及代碼示例
- Node.js response.writeContinue()用法及代碼示例
- Node.js http2.Http2ServerResponse response.removeHeader(name)用法及代碼示例
- Node.js response.removeHeader()用法及代碼示例
- Node.js http.ServerResponse response.getHeaderNames()用法及代碼示例
- Node.js http2.Http2ServerResponse response.hasHeader(name)用法及代碼示例
- Node.js http.ServerResponse response.removeHeader(name)用法及代碼示例
- Node.js http.ServerResponse response.hasHeader(name)用法及代碼示例
- Node.js response.setHeader()用法及代碼示例
- Node.js http.ServerResponse response.getHeader(name)用法及代碼示例
- Node.js http.ServerResponse response.getHeaders()用法及代碼示例
- Node.js http2.Http2ServerResponse response.setHeader(name, value)用法及代碼示例
- Node.js response.hasHeader()用法及代碼示例
- Node.js response.getHeaders()用法及代碼示例
- Node.js http2.Http2ServerResponse response.getHeaders()用法及代碼示例
- Node.js http.ServerResponse response.socket用法及代碼示例
- Node.js response.writeHead()用法及代碼示例
- Node.js http2.Http2ServerResponse response.writeHead(statusCode[, statusMessage][, headers])用法及代碼示例
- Node.js http.ServerResponse response.statusMessage用法及代碼示例
- Node.js http2.Http2ServerResponse response.getHeader(name)用法及代碼示例
- Node.js response.getHeaderNames()用法及代碼示例
- Node.js response.write()用法及代碼示例
- Node.js http.ServerResponse response.setHeader(name, value)用法及代碼示例
- Node.js http2.Http2ServerResponse response.socket用法及代碼示例
注:本文由純淨天空篩選整理自nodejs.org大神的英文原創作品 response.addTrailers(headers)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。