chore: 修改自定义 http header 名称
--bug=1009531 --user=刘瑞斌 [接口测试]-github#9212-导入metersphere格式的接口场景用例时,再次编辑无法选择运行环境,导致用例无法执行 https://www.tapd.cn/55049933/s/1090711 Closes #9212
This commit is contained in:
parent
b32788bd3d
commit
063c512f63
|
@ -70,9 +70,9 @@ public class SessionUtils {
|
||||||
public static String getCurrentWorkspaceId() {
|
public static String getCurrentWorkspaceId() {
|
||||||
try {
|
try {
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
||||||
LogUtil.info("WORKSPACE_ID: {}", request.getHeader("WORKSPACE_ID"));
|
LogUtil.info("WORKSPACE: {}", request.getHeader("WORKSPACE"));
|
||||||
if (request.getHeader("WORKSPACE_ID") != null) {
|
if (request.getHeader("WORKSPACE") != null) {
|
||||||
return request.getHeader("WORKSPACE_ID");
|
return request.getHeader("WORKSPACE");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ public class SessionUtils {
|
||||||
public static String getCurrentProjectId() {
|
public static String getCurrentProjectId() {
|
||||||
try {
|
try {
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
||||||
LogUtil.info("PROJECT_ID: {}", request.getHeader("PROJECT_ID"));
|
LogUtil.info("PROJECT: {}", request.getHeader("PROJECT"));
|
||||||
if (request.getHeader("PROJECT_ID") != null) {
|
if (request.getHeader("PROJECT") != null) {
|
||||||
return request.getHeader("PROJECT_ID");
|
return request.getHeader("PROJECT");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ export function registerRequestHeaders() {
|
||||||
config.headers['CSRF-TOKEN'] = user.csrfToken;
|
config.headers['CSRF-TOKEN'] = user.csrfToken;
|
||||||
}
|
}
|
||||||
// 包含 工作空间 项目的标识
|
// 包含 工作空间 项目的标识
|
||||||
config.headers['WORKSPACE_ID'] = getCurrentWorkspaceId();
|
config.headers['WORKSPACE'] = getCurrentWorkspaceId();
|
||||||
config.headers['PROJECT_ID'] = getCurrentProjectID();
|
config.headers['PROJECT'] = getCurrentProjectID();
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue