From 063c512f63dc71b26fbd3d793f8f072b328776d0 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 11 Jan 2022 18:55:51 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=20http=20header=20=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009531 --user=刘瑞斌 [接口测试]-github#9212-导入metersphere格式的接口场景用例时,再次编辑无法选择运行环境,导致用例无法执行 https://www.tapd.cn/55049933/s/1090711 Closes #9212 --- .../io/metersphere/commons/utils/SessionUtils.java | 12 ++++++------ frontend/src/common/js/ajax.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java b/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java index 30402447ea..c9f04a0cad 100644 --- a/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java +++ b/backend/src/main/java/io/metersphere/commons/utils/SessionUtils.java @@ -70,9 +70,9 @@ public class SessionUtils { public static String getCurrentWorkspaceId() { try { HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); - LogUtil.info("WORKSPACE_ID: {}", request.getHeader("WORKSPACE_ID")); - if (request.getHeader("WORKSPACE_ID") != null) { - return request.getHeader("WORKSPACE_ID"); + LogUtil.info("WORKSPACE: {}", request.getHeader("WORKSPACE")); + if (request.getHeader("WORKSPACE") != null) { + return request.getHeader("WORKSPACE"); } } catch (Exception e) { } @@ -82,9 +82,9 @@ public class SessionUtils { public static String getCurrentProjectId() { try { HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); - LogUtil.info("PROJECT_ID: {}", request.getHeader("PROJECT_ID")); - if (request.getHeader("PROJECT_ID") != null) { - return request.getHeader("PROJECT_ID"); + LogUtil.info("PROJECT: {}", request.getHeader("PROJECT")); + if (request.getHeader("PROJECT") != null) { + return request.getHeader("PROJECT"); } } catch (Exception e) { } diff --git a/frontend/src/common/js/ajax.js b/frontend/src/common/js/ajax.js index 837b015905..acc9591c4d 100644 --- a/frontend/src/common/js/ajax.js +++ b/frontend/src/common/js/ajax.js @@ -11,8 +11,8 @@ export function registerRequestHeaders() { config.headers['CSRF-TOKEN'] = user.csrfToken; } // 包含 工作空间 项目的标识 - config.headers['WORKSPACE_ID'] = getCurrentWorkspaceId(); - config.headers['PROJECT_ID'] = getCurrentProjectID(); + config.headers['WORKSPACE'] = getCurrentWorkspaceId(); + config.headers['PROJECT'] = getCurrentProjectID(); return config; }); }