From 028c5c91f4d1ed684e4ce182247684abb0e52f8c Mon Sep 17 00:00:00 2001 From: hyb1996 <946994919@qq.com> Date: Tue, 28 Nov 2017 23:11:35 +0800 Subject: [PATCH] fix: http wrapResponse crash --- autojs/src/main/assets/modules/__http__.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autojs/src/main/assets/modules/__http__.js b/autojs/src/main/assets/modules/__http__.js index a965b035..2d56fed5 100644 --- a/autojs/src/main/assets/modules/__http__.js +++ b/autojs/src/main/assets/modules/__http__.js @@ -109,11 +109,13 @@ module.exports = function(runtime, scope){ for(var i = 0; i < headers.size(); i++){ r.headers[headers.name(i)] = headers.value(i); } - r.body = Object.create(res.body()); + r.body = {}; + var body = res.body(); + r.body.string = body.string.bind(body); r.body.json = function(){ return JSON.parse(r.body.string()); } - r.body.contentType = r.body.contentType(); + r.body.contentType = body.contentType(); r.request = res.request(); r.url = r.request.url(); r.method = r.request.method();