Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

add missing headers

Steven Tey0eff390eca3f
diff --git a/apps/web/app/api/links/bulk/route.ts b/apps/web/app/api/links/bulk/route.ts
index 99ca1174f9..81380fcabf 100644
--- a/apps/web/app/api/links/bulk/route.ts
+++ b/apps/web/app/api/links/bulk/route.ts
@@ -50,7 +50,7 @@ export const POST = withAuth(
const validLinksResponse =
validLinks.length > 0 ? await bulkCreateLinks(validLinks) : [];
- return NextResponse.json([...validLinksResponse, ...errors]);
+ return NextResponse.json([...validLinksResponse, ...errors], { headers });
},
{
requiredPlan: ["pro", "enterprise"],
diff --git a/apps/web/app/api/links/info/route.ts b/apps/web/app/api/links/info/route.ts
index 2ce3ba8b63..8d94b8c509 100644
--- a/apps/web/app/api/links/info/route.ts
+++ b/apps/web/app/api/links/info/route.ts
@@ -19,6 +19,7 @@ export const GET = withAuth(async ({ headers, searchParams }) => {
if (!response) {
return new Response("Link not found.", {
status: 404,
+ headers,
});
}
return NextResponse.json(response, {
diff --git a/apps/web/app/api/projects/[slug]/route.ts b/apps/web/app/api/projects/[slug]/route.ts
index 294c105048..0279087414 100644
--- a/apps/web/app/api/projects/[slug]/route.ts
+++ b/apps/web/app/api/projects/[slug]/route.ts
@@ -4,8 +4,8 @@ import prisma from "@/lib/prisma";
import { deleteProject } from "@/lib/api/project";
// GET /api/projects/[slug] – get a specific project
-export const GET = withAuth(async ({ project }) => {
- return NextResponse.json(project);
+export const GET = withAuth(async ({ project, headers }) => {
+ return NextResponse.json(project, { headers });
});
// PUT /api/projects/[slug] – update a specific project
diff --git a/apps/web/app/api/projects/[slug]/tags/route.ts b/apps/web/app/api/projects/[slug]/tags/route.ts
index 1fbacddd61..f8d6a4de12 100644
--- a/apps/web/app/api/projects/[slug]/tags/route.ts
+++ b/apps/web/app/api/projects/[slug]/tags/route.ts
@@ -4,7 +4,7 @@ import { randomBadgeColor } from "@/ui/links/tag-badge";
import { NextResponse } from "next/server";
// GET /api/projects/[slug]/tags - get all tags for a project
-export const GET = withAuth(async ({ project }) => {
+export const GET = withAuth(async ({ project, headers }) => {
const tags = await prisma.tag.findMany({
where: {
projectId: project.id,
@@ -18,11 +18,11 @@ export const GET = withAuth(async ({ project }) => {
name: "asc",
},
});
- return NextResponse.json(tags);
+ return NextResponse.json(tags, { headers });
});
// POST /api/projects/[slug]/tags - create a tag for a project
-export const POST = withAuth(async ({ req, project }) => {
+export const POST = withAuth(async ({ req, project, headers }) => {
const tagsCount = await prisma.tag.count({
where: {
projectId: project.id,
@@ -44,5 +44,5 @@ export const POST = withAuth(async ({ req, project }) => {
projectId: project.id,
},
});
- return NextResponse.json(response);
+ return NextResponse.json(response, { headers });
});
diff --git a/apps/web/app/api/projects/route.ts b/apps/web/app/api/projects/route.ts
index 93559a9aba..4b354c1ade 100644
--- a/apps/web/app/api/projects/route.ts
+++ b/apps/web/app/api/projects/route.ts
@@ -10,7 +10,7 @@ import prisma from "@/lib/prisma";
import { DEFAULT_REDIRECTS, validSlugRegex } from "@dub/utils";
// GET /api/projects - get all projects for the current user
-export const GET = withAuth(async ({ session }) => {
+export const GET = withAuth(async ({ session, headers }) => {
const projects = await prisma.project.findMany({
where: {
users: {
@@ -23,7 +23,7 @@ export const GET = withAuth(async ({ session }) => {
domains: true,
},
});
- return NextResponse.json(projects);
+ return NextResponse.json(projects, { headers });
});
export const POST = withAuth(async ({ req, session }) => {