diff options
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 5d1492779..bb70e8759 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -2528,6 +2528,23 @@ public class ServerTests { } @Test + public void ldRequestToBlogShouldRedirect() throws Exception { + var htmlUri = String.format("/ugnich/"); + var ldUri = String.format("/u/ugnich"); + mockMvc.perform(get(htmlUri).accept(Context.LD_JSON_MEDIA_TYPE)).andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrl(ldUri)); + mockMvc.perform(get(htmlUri).accept(MediaType.APPLICATION_JSON)).andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrl(ldUri)); + var mastodonAcceptHeader = "application/activity+json, application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\", text/html;q=0.1"; + mockMvc.perform(get(htmlUri).accept(mastodonAcceptHeader)).andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrl(ldUri)); + var webclientHeader = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"; + mockMvc.perform(get(htmlUri).accept(webclientHeader)).andExpect(status().isOk()); + mockMvc.perform(get(htmlUri)).andExpect(status().isOk()); + mockMvc.perform(get(ldUri)).andExpect(status().isOk()); + } + + @Test @Transactional public void unsignedOverlowTest() throws Exception { var result = commandsManager.processCommand(ugnich, "test", emptyUri); |