DIV CSS 佈局教程網

Node.js 中 http.response.addTrailers 方法詳解與使用教學
編輯:關於JavaScript     

方法說明

用來把 HTTP trailing header 附加到訊息尾端。Trailer 通常用於在本文送完之後才確定的資訊,例如內容的雜湊值。

語法

response.addTrailers(headers)

參數說明

headers:要附加的標頭資訊。

範例

response.writeHead(200, {
  'Content-Type': 'text/plain',
  'Trailer': 'Content-MD5'
});
response.write(fileData);
response.addTrailers({'Content-MD5': "7895bf4b8828b55ceaf47747b4bca667"});
response.end();

關鍵細節:使用 trailer 之前,必須先在 writeHead 中透過 Trailer 標頭「預告」你稍後會送出哪些欄位,否則客戶端不會解析它們。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved