Comparing version 0.0.5 to 0.0.6
0.0.6 / 2012-11-21 | ||
================== | ||
* fix http.request() twice bug; add res.setEncoding method | ||
0.0.5 / 2012-11-21 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -116,5 +116,2 @@ /*! | ||
headers = headers || {}; | ||
if (!Array.isArray(data)) { | ||
data = [data]; | ||
} | ||
if (delay) { | ||
@@ -125,2 +122,11 @@ delay = parseInt(delay, 10); | ||
mod.request = function (options, callback) { | ||
var datas = []; | ||
if (!Array.isArray(data)) { | ||
datas = [data]; | ||
} else { | ||
for (var i = 0; i < data.length; i++) { | ||
datas.push(data[i]); | ||
} | ||
} | ||
var match = matchURL(options, url); | ||
@@ -138,5 +144,8 @@ if (!match) { | ||
var res = new EventEmitter(); | ||
res.setEncoding = function (charset) { | ||
res.charset = charset; | ||
}; | ||
res.headers = headers; | ||
var ondata = function () { | ||
var chunk = data.shift(); | ||
var chunk = datas.shift(); | ||
if (!chunk) { | ||
@@ -153,2 +162,5 @@ if (!req._aborted) { | ||
} | ||
if (res.charset) { | ||
chunk = chunk.toString(res.charset); | ||
} | ||
res.emit('data', chunk); | ||
@@ -155,0 +167,0 @@ } |
{ | ||
"name": "mm", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "mock mate, mock http request, fs access and so on.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12223
219