@jsonapi-serde/integration-koa 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/response.d.ts +2 -3
- package/dist/response.js +2 -1
- package/dist/response.js.map +1 -1
- package/package.json +1 -1
package/dist/response.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { JsonApiDocument } from "@jsonapi-serde/server/common";
|
|
2
|
-
import type {
|
|
3
|
-
import type { JsonApiContextState } from "./middleware.js";
|
|
2
|
+
import type { Context as KoaContext } from "koa";
|
|
4
3
|
/**
|
|
5
4
|
* Sends a JSON:API response using the given Koa context and JSON:API document
|
|
6
5
|
*
|
|
@@ -23,4 +22,4 @@ import type { JsonApiContextState } from "./middleware.js";
|
|
|
23
22
|
* });
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare const sendJsonApiResponse: (context:
|
|
25
|
+
export declare const sendJsonApiResponse: (context: KoaContext, document: JsonApiDocument) => void;
|
package/dist/response.js
CHANGED
|
@@ -24,7 +24,8 @@ export const sendJsonApiResponse = (context, document) => {
|
|
|
24
24
|
if (!context.state.jsonApi) {
|
|
25
25
|
throw new Error("You must register `jsonApiRequestMiddleware` in Koa");
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
const jsonApiState = context.state;
|
|
28
|
+
document.verifyAcceptMediaType(jsonApiState.jsonApi.acceptableTypes);
|
|
28
29
|
context.status = document.getStatus();
|
|
29
30
|
context.body = document.getBody();
|
|
30
31
|
context.set("content-type", document.getContentType());
|
package/dist/response.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAmB,EAAE,QAAyB,EAAQ,EAAE;IACxF,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,YAAY,GAAG,OAAO,CAAC,KAA4B,CAAC;IAE1D,QAAQ,CAAC,qBAAqB,CAAC,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAErE,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IACtC,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;AAC3D,CAAC,CAAC"}
|