Unverified Commit a4156e66 authored by Hong Minhee's avatar Hong Minhee
Browse files

Change response content type

parent c6eda9ec
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -41,11 +41,13 @@ export const handler: Handler<PostPageData> = async (req, ctx) => {
    accept === "application/ld+json" || accept === "application/json"
  ) {
    const fedCtx = federation.createContext(req);
    const note = toArticle(fedCtx, blog, post, comments);
    const jsonLd = await note.toJsonLd(fedCtx);
    const article = toArticle(fedCtx, blog, post, comments);
    const jsonLd = await article.toJsonLd(fedCtx);
    return new Response(JSON.stringify(jsonLd), {
      headers: {
        "Content-Type": "application/ld+json",
        "Content-Type": "application/activity+json",
        Link:
          `<${article.id}>; rel="alternate"; type="application/activity+json"`,
        Vary: "Accept",
      },
    });
+3 −5
Original line number Diff line number Diff line
@@ -66,8 +66,7 @@ export async function handleActor<TContextData>(
  const jsonLd = await actor.toJsonLd({ documentLoader });
  return new Response(JSON.stringify(jsonLd), {
    headers: {
      "Content-Type":
        'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
      "Content-Type": "application/activity+json",
      Vary: "Accept",
    },
  });
@@ -204,8 +203,7 @@ export async function handleCollection<
  const jsonLd = await collection.toJsonLd({ documentLoader });
  return new Response(JSON.stringify(jsonLd), {
    headers: {
      "Content-Type":
        'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
      "Content-Type": "application/activity+json",
      Vary: "Accept",
    },
  });
@@ -254,7 +252,7 @@ export async function handleInbox<TContextData>(
  }
  const keyId = await verify(request, documentLoader);
  if (keyId == null) {
    const response = new Response("Failed to verify the reuqest signature.", {
    const response = new Response("Failed to verify the request signature.", {
      status: 401,
      headers: { "Content-Type": "text/plain; charset=utf-8" },
    });