aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-05-05 12:24:58 +0300
committerGravatar Vitaly Takmazov2019-05-05 12:24:58 +0300
commit916b8fd13b19f3ce7ed0f7dda1eea2b8892b0cb3 (patch)
tree01b35eff660b6bb2687cc0b6dc60a5fa2c06e793
parent6600ac2ea29a8ccc6a2f23814f3179f0f6d45cfd (diff)
Fix /ws/ redirects
-rw-r--r--src/main/java/com/juick/server/configuration/SecurityConfig.java2
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java13
2 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/com/juick/server/configuration/SecurityConfig.java b/src/main/java/com/juick/server/configuration/SecurityConfig.java
index df0da16e..30632a07 100644
--- a/src/main/java/com/juick/server/configuration/SecurityConfig.java
+++ b/src/main/java/com/juick/server/configuration/SecurityConfig.java
@@ -222,7 +222,7 @@ public class SecurityConfig {
@Override
public void configure(WebSecurity web) {
web.debug(false);
- web.ignoring().antMatchers("/style*.css", "/scripts*.js", "/h2-console/**", "/.well-known/**", "/ws/**");
+ web.ignoring().antMatchers("/style*.css", "/scripts*.js", "/h2-console/**", "/.well-known/**");
}
}
}
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index c554f20e..322d4de7 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -2048,4 +2048,17 @@ public class ServerTests {
.andExpect(status().isOk())
.andExpect(content().contentType("application/rss+xml;charset=UTF-8"));
}
+
+ @Test
+ public void wsThreadsShouldRedirect() throws Exception {
+ int mid = messagesService.createMessage(ugnich.getUid(), "tst", null, Collections.emptyList());
+ mockMvc.perform(get("/ugnich/" + mid))
+ .andExpect(status().isOk());
+ mockMvc.perform(get("/s/" + mid))
+ .andExpect(status().isFound())
+ .andExpect(redirectedUrl("/ugnich/" + mid));
+ mockMvc.perform(get("/ws/" + mid))
+ .andExpect(status().isFound())
+ .andExpect(redirectedUrl("/ugnich/" + mid));
+ }
}