From b117ed78b201fa2e12102043e22825ccecbc0d09 Mon Sep 17 00:00:00 2001 From: Konrad Dzwinel Date: Tue, 29 Dec 2015 05:07:47 +0100 Subject: [PATCH] Use custom http-mitm-proxy version that implements onRequestEnd --- lib/traffic-interceptor.js | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/traffic-interceptor.js b/lib/traffic-interceptor.js index 22961ee..63eba5e 100644 --- a/lib/traffic-interceptor.js +++ b/lib/traffic-interceptor.js @@ -43,10 +43,14 @@ function handleIncomingRequest(ctx, callback) { ctx.onRequestData(function(ctx, chunk, callback) { chunks.push(chunk); + return callback(null, chunk); + }); + + ctx.onRequestEnd(function(ctx, callback) { connection.setRequest(ctx.clientToProxyRequest, ctx.isSSL, (Buffer.concat(chunks)).toString()); trafficInterceptor.emit('request', connection); - return callback(null, chunk); + return callback(); }); return callback(); diff --git a/package.json b/package.json index a66844f..81567ab 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "homepage": "https://github.com/kdzwinel/betwixt", "dependencies": { "chalk": "^1.1.1", - "http-mitm-proxy": "^0.2.0", + "http-mitm-proxy": "git://github.com/kdzwinel/node-http-mitm-proxy.git#onRequestEnd", "istextorbinary": "^1.0.2" }, "devDependencies": {