Permalink
Browse files

Coverage. Closes #11

  • Loading branch information...
1 parent a544365 commit 5ec5c08347235c091d1804edc792ecb6224b5d65 @hueniverse hueniverse committed May 1, 2014
Showing with 15 additions and 16 deletions.
  1. +13 −14 lib/index.js
  2. +2 −2 package.json
View
@@ -223,28 +223,27 @@ internals.finish = function (response, req, onEnd) {
var rest = payloadBlock;
res.payload = '';
- while (rest) {
+ do {
var next = rest.indexOf(CRLF);
var size = parseInt(rest.slice(0, next), 16);
if (size === 0) {
rest = rest.slice(3);
- break;
}
-
- res.payload += rest.substr(next + 2, size);
- rest = rest.slice(next + 2 + size + 2);
+ else {
+ res.payload += rest.substr(next + 2, size);
+ rest = rest.slice(next + 2 + size + 2);
+ }
}
+ while (size);
- if (rest) {
- var headers = rest.split(CRLF);
- headers.forEach(function (header) {
+ var headers = rest.split(CRLF);
+ headers.forEach(function (header) {
- var parts = header.split(':');
- if (parts.length === 2) {
- response._headers[parts[0].trim().toLowerCase()] = parts[1].trim();
- }
- });
- }
+ var parts = header.split(':');
+ if (parts.length === 2) {
+ response._headers[parts[0].trim().toLowerCase()] = parts[1].trim();
+ }
+ });
};
};
View
@@ -1,7 +1,7 @@
{
"name": "shot",
"description": "Injects a fake HTTP request/response into a node HTTP server",
- "version": "1.3.2",
+ "version": "1.3.3",
"repository": "git://github.com/spumko/shot",
"main": "index",
"keywords": [
@@ -16,7 +16,7 @@
"dependencies": {
},
"devDependencies": {
- "lab": "1.x.x"
+ "lab": "3.x.x"
},
"scripts": {
"test": "make test-cov"

0 comments on commit 5ec5c08

Please sign in to comment.