@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 CHANGED
@@ -1,4 +1,4 @@
1
- ## 0.3.6 (2025-09-05)
1
+ ## 0.3.9 (2025-09-05)
2
2
 
3
3
 
4
4
 
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rdyl/node-koa-controller",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
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>;