From cbfb578bce95dea78e6659bd31713342a682b882 Mon Sep 17 00:00:00 2001 From: suxiaoxin Date: Tue, 19 Sep 2017 17:49:59 +0800 Subject: [PATCH] fix: interfaceContent go back view bug --- .../Project/Interface/InterfaceList/InterfaceContent.js | 2 +- exts/yapi-plugin-advanced-mock/server.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceContent.js b/client/containers/Project/Interface/InterfaceList/InterfaceContent.js index a5b1ccda..41b355d4 100755 --- a/client/containers/Project/Interface/InterfaceList/InterfaceContent.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceContent.js @@ -98,7 +98,7 @@ class Content extends Component { let tabContent = null; if (this.state.curtab) { let C = InterfaceTabs[this.state.curtab].component; - tabContent = ; + tabContent = ; } return
diff --git a/exts/yapi-plugin-advanced-mock/server.js b/exts/yapi-plugin-advanced-mock/server.js index 1dc8670e..75af1d1b 100644 --- a/exts/yapi-plugin-advanced-mock/server.js +++ b/exts/yapi-plugin-advanced-mock/server.js @@ -44,12 +44,18 @@ module.exports = function(){ } let script = data.mock_script; let sandbox = { + header: context.ctx.header, query: context.ctx.query, body: context.ctx.request.body, mockJson: context.mockJson } + sandbox.cookie = {}; + + context.ctx.header.cookie && context.ctx.header.cookie.split(';').forEach(function( Cookie ) { + var parts = Cookie.split('='); + sandbox.cookie[ parts[ 0 ].trim() ] = ( parts[ 1 ] || '' ).trim(); + }); sandbox = yapi.commons.sandbox(sandbox, script); context.mockJson = sandbox.mockJson; - console.log(11111, context.mockJson) }) } \ No newline at end of file