From 2cc2244ae9e604a65e172da81a753e34c8a8d55d Mon Sep 17 00:00:00 2001 From: sheng <625171796@qq.com> Date: Wed, 29 Nov 2023 14:52:10 +0800 Subject: [PATCH 1/3] add datamanager header to distinguish proxy flow and datamanager save flow --- frontend/src/views/datamanager/DataDetailHttpData.vue | 1 + lyrebird/mock/blueprints/apis/mock.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/frontend/src/views/datamanager/DataDetailHttpData.vue b/frontend/src/views/datamanager/DataDetailHttpData.vue index 6ba7585ff..34beacae4 100644 --- a/frontend/src/views/datamanager/DataDetailHttpData.vue +++ b/frontend/src/views/datamanager/DataDetailHttpData.vue @@ -184,6 +184,7 @@ export default { Object.assign(newReq, JSON.parse(this.editorCache.req)) newReq['data'] = this.editorCache.reqData newData['request'] = newReq + newData['request']['headers']['internal_flow'] = 'datamanager' // Add response const newResp = {} Object.assign(newResp, JSON.parse(this.editorCache.resp)) diff --git a/lyrebird/mock/blueprints/apis/mock.py b/lyrebird/mock/blueprints/apis/mock.py index c69b47fc9..a8d642524 100644 --- a/lyrebird/mock/blueprints/apis/mock.py +++ b/lyrebird/mock/blueprints/apis/mock.py @@ -114,6 +114,8 @@ def put(self): data = request.json # Import encoder for encoding the requested content application.encoders_decoders.encoder_handler(data) + if 'internal_flow' in data['request']['headers']: + del data['request']['headers']['internal_flow'] context.application.data_manager.update_data(data_id, data) context.application.data_manager.reactive() return context.make_ok_response() From 19f8f9cb72e1d45899243f99e73557c1f46c3cfa Mon Sep 17 00:00:00 2001 From: sheng <625171796@qq.com> Date: Wed, 29 Nov 2023 14:55:35 +0800 Subject: [PATCH 2/3] change name --- frontend/src/views/datamanager/DataDetailHttpData.vue | 2 +- lyrebird/mock/blueprints/apis/mock.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/datamanager/DataDetailHttpData.vue b/frontend/src/views/datamanager/DataDetailHttpData.vue index 34beacae4..fc5a0b0e2 100644 --- a/frontend/src/views/datamanager/DataDetailHttpData.vue +++ b/frontend/src/views/datamanager/DataDetailHttpData.vue @@ -184,7 +184,7 @@ export default { Object.assign(newReq, JSON.parse(this.editorCache.req)) newReq['data'] = this.editorCache.reqData newData['request'] = newReq - newData['request']['headers']['internal_flow'] = 'datamanager' + newData['request']['headers']['lyrebirdInternalFlow'] = 'datamanager' // Add response const newResp = {} Object.assign(newResp, JSON.parse(this.editorCache.resp)) diff --git a/lyrebird/mock/blueprints/apis/mock.py b/lyrebird/mock/blueprints/apis/mock.py index a8d642524..7a6e3e24e 100644 --- a/lyrebird/mock/blueprints/apis/mock.py +++ b/lyrebird/mock/blueprints/apis/mock.py @@ -114,8 +114,8 @@ def put(self): data = request.json # Import encoder for encoding the requested content application.encoders_decoders.encoder_handler(data) - if 'internal_flow' in data['request']['headers']: - del data['request']['headers']['internal_flow'] + if 'lyrebirdInternalFlow' in data['request']['headers']: + del data['request']['headers']['lyrebirdInternalFlow'] context.application.data_manager.update_data(data_id, data) context.application.data_manager.reactive() return context.make_ok_response() From a0f25713db2486727ae9cc04f4ab2a96301a76d9 Mon Sep 17 00:00:00 2001 From: sheng <625171796@qq.com> Date: Wed, 29 Nov 2023 15:12:22 +0800 Subject: [PATCH 3/3] fix when data is not a flow --- frontend/src/views/datamanager/DataDetailHttpData.vue | 3 ++- lyrebird/mock/blueprints/apis/mock.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/datamanager/DataDetailHttpData.vue b/frontend/src/views/datamanager/DataDetailHttpData.vue index fc5a0b0e2..b1a21393e 100644 --- a/frontend/src/views/datamanager/DataDetailHttpData.vue +++ b/frontend/src/views/datamanager/DataDetailHttpData.vue @@ -184,12 +184,13 @@ export default { Object.assign(newReq, JSON.parse(this.editorCache.req)) newReq['data'] = this.editorCache.reqData newData['request'] = newReq - newData['request']['headers']['lyrebirdInternalFlow'] = 'datamanager' // Add response const newResp = {} Object.assign(newResp, JSON.parse(this.editorCache.resp)) newResp['data'] = this.editorCache.respData newData['response'] = newResp + // Add Flag + newData['lyrebirdInternalFlow'] = 'datamanager' this.$store.commit('setIsReloadTreeWhenUpdate', this.dataDetail.name !== newData.name) diff --git a/lyrebird/mock/blueprints/apis/mock.py b/lyrebird/mock/blueprints/apis/mock.py index 7a6e3e24e..9c599a409 100644 --- a/lyrebird/mock/blueprints/apis/mock.py +++ b/lyrebird/mock/blueprints/apis/mock.py @@ -114,8 +114,8 @@ def put(self): data = request.json # Import encoder for encoding the requested content application.encoders_decoders.encoder_handler(data) - if 'lyrebirdInternalFlow' in data['request']['headers']: - del data['request']['headers']['lyrebirdInternalFlow'] + if 'lyrebirdInternalFlow' in data: + del data['lyrebirdInternalFlow'] context.application.data_manager.update_data(data_id, data) context.application.data_manager.reactive() return context.make_ok_response()