@nestjs/platform-fastify 12.0.0-alpha.6 → 12.0.0

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.
@@ -98,7 +98,7 @@ export declare class FastifyAdapter<TServer extends RawServerBase = RawServerDef
98
98
  isHeadersSent(response: TReply): boolean;
99
99
  getHeader(response: any, name: string): any;
100
100
  setHeader(response: TReply, name: string, value: string): FastifyReply<RouteGenericInterface, TServer, TRawRequest, TRawResponse, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>;
101
- appendHeader(response: any, name: string, value: string): void;
101
+ appendHeader(response: any, name: string, value: string): any;
102
102
  getRequestHostname(request: TRequest): string;
103
103
  getRequestMethod(request: TRequest): string;
104
104
  getRequestUrl(request: TRequest): string;
@@ -331,7 +331,17 @@ export class FastifyAdapter extends AbstractHttpAdapter {
331
331
  return response.header(name, value);
332
332
  }
333
333
  appendHeader(response, name, value) {
334
- response.header(name, value);
334
+ const current = response.getHeader(name);
335
+ if (current === undefined) {
336
+ return response.header(name, value);
337
+ }
338
+ // Fastify Reply.header() already concatenates set-cookie.
339
+ // Re-passing the accumulated list would duplicate previous cookies.
340
+ if (String(name).toLowerCase() === 'set-cookie') {
341
+ return response.header(name, value);
342
+ }
343
+ const values = Array.isArray(current) ? current : [current];
344
+ return response.header(name, values.concat(value));
335
345
  }
336
346
  getRequestHostname(request) {
337
347
  return request.hostname;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/platform-fastify",
3
- "version": "12.0.0-alpha.6",
3
+ "version": "12.0.0",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@platform-fastify)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -50,5 +50,5 @@
50
50
  "optional": true
51
51
  }
52
52
  },
53
- "gitHead": "4c38a5ab100f1d2a0d50602998968a25509525c7"
53
+ "gitHead": "6494a6c27400547ea6cd9b78da07b2e9c2547ca0"
54
54
  }