Permalink
Browse files

fix json test, dont use freelist

  • Loading branch information...
1 parent 8f8f438 commit dd8e194d16ce78407089b5c4e9fd5718fdb47e4f @chjj chjj committed Oct 19, 2011
Showing with 4 additions and 21 deletions.
  1. +2 −20 lib/json.js
  2. +2 −1 test/index.js
View
@@ -4,8 +4,7 @@
*/
var EventEmitter = require('events').EventEmitter
- , StringDecoder = require('string_decoder').StringDecoder
- , FreeList = require('freelist').FreeList;
+ , StringDecoder = require('string_decoder').StringDecoder;
/**
* Parser
@@ -469,22 +468,6 @@ Parser.prototype.destroy = function(err) {
};
/**
- * Legacy
- */
-
-Parser.create = function(options) {
- return new Parser(options);
-};
-
-/**
- * Pool
- */
-
-//var parsers = new FreeList('parsers', 20, function() {
-// return new Parser();
-//});
-
-/**
* Expose
*/
@@ -514,7 +497,7 @@ exports.middleware = function(options) {
};
exports.handle = function(req, res, next, options) {
- var parser = new Parser(options) //parsers.alloc()
+ var parser = new Parser(options)
, limit = options.jsonLimit || options.limit;
parser.on('error', function(err) {
@@ -523,7 +506,6 @@ exports.handle = function(req, res, next, options) {
});
parser.on('end', function(data) {
- //parsers.free(parser);
req.body = data;
next();
});
View
@@ -123,6 +123,7 @@ var main = function(argv) {
multiple('opera', function() {
multiple('firefox', function() {
console.log('DONE');
+ if (!argv.length) json(), encoded();
});
});
});
@@ -142,7 +143,7 @@ var json = function() {
var TEST_JSON = '{"a":{"b":100,"c":[2,3]},"d":["e"],"f":true}';
var Parser = require('../lib/json');
- var parser = Parser.create();
+ var parser = new Parser();
parser.on('end', function(obj) {
console.log(obj);

0 comments on commit dd8e194

Please sign in to comment.