common-log-format
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -27,3 +27,3 @@ "use strict"; | ||
status: Number(matches[6]), | ||
bytes: Number(matches[7]) | ||
bytes: Number(matches[7]) || 0 | ||
}; | ||
@@ -30,0 +30,0 @@ self.push(JSON.stringify(obj)); |
{ | ||
"name": "common-log-format", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "A transform stream, converting common log format to JSON", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/75lb/common-log-format.git", |
@@ -61,1 +61,20 @@ var test = require("tape"); | ||
}); | ||
test("non-numeric bytes", function(t){ | ||
t.plan(1); | ||
var transform = new Clf(); | ||
transform.on("readable", function(){ | ||
var json = this.read(); | ||
logObject = JSON.parse(json); | ||
t.deepEqual(logObject, { | ||
remoteHost: "127.0.0.1", | ||
remoteLogName: "-", | ||
authUser: "-", | ||
date: "2014-06-11T15:51:48.000Z", | ||
request: "GET /package.json HTTP/1.1", | ||
status: 200, | ||
bytes: 0 | ||
}); | ||
}); | ||
transform.write('127.0.0.1 - - [Wed, 11 Jun 2014 15:51:48 GMT] "GET /package.json HTTP/1.1" 200 - "http://localhost:8000/" "userAgent"'); | ||
}); |
6892
107