From 49fa64833f2eb3942eff55b7410932e70e4fc54e Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期五, 11 九月 2026 12:53:47 +0800
Subject: [PATCH] 跨域配置更新
---
talent-card-server/src/test/java/com/talentcard/server/config/ApiCorsConfigTests.java | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/talent-card-server/src/test/java/com/talentcard/server/config/ApiCorsConfigTests.java b/talent-card-server/src/test/java/com/talentcard/server/config/ApiCorsConfigTests.java
index 957a2bd..071501d 100644
--- a/talent-card-server/src/test/java/com/talentcard/server/config/ApiCorsConfigTests.java
+++ b/talent-card-server/src/test/java/com/talentcard/server/config/ApiCorsConfigTests.java
@@ -24,7 +24,7 @@
@SpringJUnitConfig({ApiCorsConfig.class, ApiCorsConfigTests.TestMvcConfig.class})
@WebAppConfiguration
-@TestPropertySource(properties = "app.cors.allowed-origins=http://localhost:7894,http://127.0.0.1:7893")
+@TestPropertySource(properties = "app.cors.allowed-origins=http://localhost:7894,http://127.0.0.1:7893,http://192.168.110.26:5173")
class ApiCorsConfigTests {
@Autowired
private WebApplicationContext context;
@@ -77,6 +77,16 @@
.andExpect(status().isUnauthorized());
}
+ @Test
+ void lanAdminFrontendCanPreflightLogin() throws Exception {
+ mvc.perform(options("/api/admin/auth/login")
+ .header("Origin", "http://192.168.110.26:5173")
+ .header("Access-Control-Request-Method", "POST")
+ .header("Access-Control-Request-Headers", "content-type,x-request-id"))
+ .andExpect(status().isOk())
+ .andExpect(header().string("Access-Control-Allow-Origin", "http://192.168.110.26:5173"));
+ }
+
@Configuration
@EnableWebMvc
static class TestMvcConfig {
--
Gitblit v1.7.1