@rdyl/node-koa-controller 0.3.7 → 0.3.9
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/CHANGELOG.md +1 -1
- package/dist/meta.js +7 -0
- package/package.json +1 -1
- package/types/meta.d.ts +4 -0
package/CHANGELOG.md
CHANGED
package/dist/meta.js
CHANGED
|
@@ -135,6 +135,13 @@ var BaseController = /** @class */ (function () {
|
|
|
135
135
|
_this._ctx.body = body;
|
|
136
136
|
};
|
|
137
137
|
return {
|
|
138
|
+
raw: function (body, headers) {
|
|
139
|
+
var _a;
|
|
140
|
+
if (headers === void 0) { headers = {}; }
|
|
141
|
+
_this._ctx.response.set("Content-Type", (_a = headers["Content-Type"]) !== null && _a !== void 0 ? _a : "application/json;charset=utf-8");
|
|
142
|
+
_this._ctx.status = 200;
|
|
143
|
+
_this._ctx.body = body;
|
|
144
|
+
},
|
|
138
145
|
ok: function (data) {
|
|
139
146
|
sendJson({ data: data, code: 200, msg: "ok" });
|
|
140
147
|
},
|
package/package.json
CHANGED
package/types/meta.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare class BaseController {
|
|
|
30
30
|
get body(): any;
|
|
31
31
|
files(): Promise<import("formidable").Files | undefined>;
|
|
32
32
|
get status(): {
|
|
33
|
+
raw: (body?: unknown, headers?: HandlerStatusBody) => void;
|
|
33
34
|
ok(data?: unknown): void;
|
|
34
35
|
okCreated(data: unknown, msg?: string): void;
|
|
35
36
|
okAccept(data: unknown, msg?: string): void;
|
|
@@ -86,4 +87,7 @@ export type UseJwtHandlerRes = {
|
|
|
86
87
|
export type UseJwtHandlerOpts = {
|
|
87
88
|
public: boolean;
|
|
88
89
|
};
|
|
90
|
+
export type HandlerStatusBody = {
|
|
91
|
+
"Content-Type"?: string;
|
|
92
|
+
};
|
|
89
93
|
export type UseJwtHandler = (_ctx: KoaCtx, opts: UseJwtHandlerOpts) => Promise<UseJwtHandlerRes>;
|