Skip to content

Commit

Permalink
Send non-chunked response for OPTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jun 14, 2015
1 parent bd51407 commit ec4070d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
==========

* Send non-chunked response for `OPTIONS`
* deps: etag@~1.7.0
- Always include entity length in ETags for hash length extensions
- Generate non-Stats ETags using MD5 only (no longer CRC32)
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ function favicon(path, options) {
return;
}

if ('GET' !== req.method && 'HEAD' !== req.method) {
var status = 'OPTIONS' === req.method ? 200 : 405;
res.writeHead(status, {'Allow': 'GET, HEAD, OPTIONS'});
if (req.method !== 'GET' && req.method !== 'HEAD') {
res.statusCode = req.method === 'OPTIONS' ? 200 : 405;
res.setHeader('Allow', 'GET, HEAD, OPTIONS');
res.setHeader('Content-Length', '0');
res.end();
return;
}
Expand Down

0 comments on commit ec4070d

Please sign in to comment.