HEAD requests should have the same headers as GET. #60

Merged
merged 1 commit into from Jun 29, 2012

Projects

None yet

3 participants

@pbouzakis
Contributor

No description provided.

@phstc
Collaborator
phstc commented Jun 29, 2012

There is an if before your code.

# node-static.js 195
} else if (req.method === 'HEAD') {
    finish(200, headers);

If method==='HEAD' your code will not be reached.

@pbouzakis
Contributor

Woops, forgot to include the removal of that check in my pull request. Updated the pull request.

@phstc
Collaborator
phstc commented Jun 29, 2012

rfc2616

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response

Thank you.

But.. what about the headers['Content-Type'], did you remove it?

@phstc phstc commented on the diff Jun 29, 2012
lib/node-static.js
@@ -204,6 +202,11 @@ this.Server.prototype.respond = function (pathname, status, _headers, files, sta
@phstc
phstc Jun 29, 2012 Collaborator

Where is the Content-Type?

headers['Content-Type']   = mime.contentTypes[fileExtension] || 'application/octet-stream';
@domenic
domenic Jun 29, 2012

It's on the next line. Notice how GitHub only shows the three lines surrounding each changed chunk of the file.

@phstc
phstc Jun 29, 2012 Collaborator

Thank you!

Merge done. 👍

@phstc phstc merged commit 85377fd into cloudhead:master Jun 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment