diff --git a/src/middleware.ts b/src/middleware.ts index 12e3bb5..7b8fca3 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -135,13 +135,19 @@ const handleResponse = (context: ParameterizedContext): void => { if (matchingTypes.length === 0) { context.status = 406; - context.body = new JsonApiErrorBody({ - status: "406", - code: "not_acceptable", - title: "Not Acceptable", - detail: "No valid accept types provided, you must accept application/vnd.api+json", - meta: appliedExtensions ? { appliedExtensions } : undefined, - }); + context.set("Content-Type", contentTypeUtil.format({ type: "application/vnd.api+json" })); + context.body = { + jsonapi: { version: "1.1" }, + errors: [ + { + status: "406", + code: "not_acceptable", + title: "Not Acceptable", + detail: "No valid accept types provided, you must accept application/vnd.api+json", + meta: appliedExtensions ? { appliedExtensions } : undefined, + }, + ], + }; return; } diff --git a/test/headers.test.ts b/test/accept.test.ts similarity index 100% rename from test/headers.test.ts rename to test/accept.test.ts