chore: 修改自定义 http header 名称

This commit is contained in:
CaptainB 2022-01-11 18:55:51 +08:00 committed by 刘瑞斌
parent 7aac30ccf6
commit 453de476d3
2 changed files with 8 additions and 8 deletions

View File

@ -71,9 +71,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) {
LogUtil.error(e.getMessage(), e);
@ -84,9 +84,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) {
LogUtil.error(e.getMessage(), e);

View File

@ -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;
});
}