瀏覽代碼

add Content-Length, fixes #238

jomo 5 年之前
父節點
當前提交
eae7745758
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      lib/response.js

+ 1 - 0
lib/response.js

@@ -31,6 +31,7 @@ module.exports = function(request, response, result) {
   // These headers are the same for every response
   var headers = {
     "Content-Type": result.body && result.type || "text/plain",
+    "Content-Length": Buffer.from(result.body || "").length,
     "Cache-Control": "max-age=" + config.caching.browser,
     "Response-Time": Date.now() - request.start,
     "X-Request-ID": request.id,