@efebia/fastify-zod-reply 1.0.6 → 1.0.7

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/lib/cjs/reply.js CHANGED
@@ -7,7 +7,8 @@ const createReply = (statusCode, defaultPayload) => {
7
7
  const finalPayload = payload !== null && payload !== void 0 ? payload : defaultPayload;
8
8
  if (typeof finalPayload === 'string')
9
9
  throw (0, exports.createError)(statusCode)(finalPayload);
10
- this.type("application/json");
10
+ if (typeof finalPayload !== 'undefined')
11
+ this.type("application/json");
11
12
  this.code(statusCode);
12
13
  return finalPayload;
13
14
  };
package/lib/esm/reply.js CHANGED
@@ -4,7 +4,8 @@ export const createReply = (statusCode, defaultPayload) => {
4
4
  const finalPayload = payload !== null && payload !== void 0 ? payload : defaultPayload;
5
5
  if (typeof finalPayload === 'string')
6
6
  throw createError(statusCode)(finalPayload);
7
- this.type("application/json");
7
+ if (typeof finalPayload !== 'undefined')
8
+ this.type("application/json");
8
9
  this.code(statusCode);
9
10
  return finalPayload;
10
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efebia/fastify-zod-reply",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "fastify": "^5.3.0",
@@ -12,14 +12,16 @@
12
12
  "/lib"
13
13
  ],
14
14
  "scripts": {
15
- "build:esm": "tsc --module nodenext --moduleResolution nodenext --outDir lib/esm",
16
- "build:cjs": "tsc --module commonjs --moduleResolution node --outDir lib/cjs",
17
- "build": "yarn build:esm && yarn build:cjs"
15
+ "build:esm": "tsc -p ./tsconfig.build.json --module nodenext --moduleResolution nodenext --outDir lib/esm",
16
+ "build:cjs": "tsc -p ./tsconfig.build.json --module commonjs --moduleResolution node --outDir lib/cjs",
17
+ "build": "yarn build:esm && yarn build:cjs",
18
+ "test": "node --import tsx --test ./**/*.test.ts"
18
19
  },
19
20
  "main": "./lib/esm/index.js",
20
21
  "types": "./lib/esm/index.d.ts",
21
22
  "type": "module",
22
23
  "devDependencies": {
24
+ "tsx": "^4.20.3",
23
25
  "typescript": "~5.8.3"
24
26
  },
25
27
  "exports": {