aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/server
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-19 21:57:50 +0300
committerGravatar Vitaly Takmazov2023-01-19 21:57:50 +0300
commiteb665ea6edc2aaff9f9a562c875b38b4878e2709 (patch)
tree2df0b1112ebb664e9d906834f3e3d61fb8d8d890 /src/test/java/com/juick/server
parent1e82cb7125e4aa81dcbafa4746af1f0f9651b8c1 (diff)
ActivityPub: blog redirect
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java17
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 5d149277..bb70e875 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);