| | |
| | | |
| | | @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; |
| | |
| | | .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 { |