Skip to content
This repository
Browse code

Merge pull request #60 from pbouzakis/headSameHeadersAsGet

HEAD requests should have the same headers as GET.
  • Loading branch information...
commit 85377fdab0101d097529fd68b19e450d8dbb9c61 2 parents ae7776f + 94bbfde
Pablo Cantero authored June 29, 2012

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  lib/node-static.js
7  lib/node-static.js
@@ -192,8 +192,6 @@ this.Server.prototype.respond = function (pathname, status, _headers, files, sta
192 192
     if (req.headers['if-none-match'] === headers['ETag'] ||
193 193
         Date.parse(req.headers['if-modified-since']) >= mtime) {
194 194
         finish(304, headers);
195  
-    } else if (req.method === 'HEAD') {
196  
-        finish(200, headers);
197 195
     } else {
198 196
         var fileExtension = path.extname(files[0]).slice(1).toLowerCase();
199 197
         headers['Content-Length'] = stat.size;
@@ -204,6 +202,11 @@ this.Server.prototype.respond = function (pathname, status, _headers, files, sta
204 202
 
205 203
         res.writeHead(status, headers);
206 204
 
  205
+        if (req.method === 'HEAD') {
  206
+            finish(200, headers);
  207
+            return;
  208
+        }
  209
+
207 210
         // If the file was cached and it's not older
208 211
         // than what's on disk, serve the cached version.
209 212
         if (this.cache && (key in exports.store) &&

0 notes on commit 85377fd

Please sign in to comment.
Something went wrong with that request. Please try again.