mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38:19 +01:00
fix(api): 🐛 Force text content-type header on all empty responses
Fixes a problem where the content-type would default to application/json
This commit is contained in:
parent
06376cf58a
commit
5074ac788f
|
|
@ -146,7 +146,7 @@ export default apiRoute((app) => {
|
|||
|
||||
await role.linkUser(targetUser.id);
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
});
|
||||
|
||||
app.openapi(routeDelete, async (context) => {
|
||||
|
|
@ -186,6 +186,6 @@ export default apiRoute((app) => {
|
|||
|
||||
await role.unlinkUser(targetUser.id);
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ describe(meta.route, () => {
|
|||
});
|
||||
|
||||
expect(response.ok).toBe(true);
|
||||
expect(response.headers.get("Content-Type")).not.toContain("json");
|
||||
});
|
||||
|
||||
test("should refuse invalid emails", async () => {
|
||||
|
|
|
|||
|
|
@ -337,6 +337,6 @@ export default apiRoute((app) =>
|
|||
email: email ?? "",
|
||||
});
|
||||
|
||||
return context.body(null, 200);
|
||||
return context.text("", 200);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -352,6 +352,6 @@ export default apiRoute((app) => {
|
|||
|
||||
await db.delete(Emojis).where(eq(Emojis.id, id));
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -68,6 +68,6 @@ export default apiRoute((app) =>
|
|||
dismissed: true,
|
||||
});
|
||||
|
||||
return context.body(null, 200);
|
||||
return context.text("", 200);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,6 @@ export default apiRoute((app) =>
|
|||
|
||||
await user.clearAllNotifications();
|
||||
|
||||
return context.body(null, 200);
|
||||
return context.text("", 200);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -60,6 +60,6 @@ export default apiRoute((app) =>
|
|||
|
||||
await user.clearSomeNotifications(ids);
|
||||
|
||||
return context.body(null, 200);
|
||||
return context.text("", 200);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ export default apiRoute((app) => {
|
|||
visible,
|
||||
});
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
});
|
||||
|
||||
app.openapi(routeDelete, async (context) => {
|
||||
|
|
@ -261,6 +261,6 @@ export default apiRoute((app) => {
|
|||
|
||||
await role.delete();
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -343,6 +343,6 @@ export default apiRoute((app) => {
|
|||
.delete(Filters)
|
||||
.where(and(eq(Filters.userId, user.id), eq(Filters.id, id)));
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ export default apiRoute((app) =>
|
|||
getLogger(["federation", "messaging"])
|
||||
.info`Received message via ${chalk.bold("Instance Messaging")}:\n${content}`;
|
||||
|
||||
return context.body(null, 200);
|
||||
return context.text("", 200);
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ export default (plugin: PluginType): void => {
|
|||
.delete(OpenIdAccounts)
|
||||
.where(eq(OpenIdAccounts.id, account.id));
|
||||
|
||||
return context.body(null, 204);
|
||||
return context.text("", 204);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue