@nestjs/platform-express 11.1.16 → 11.1.18

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/Readme.md CHANGED
@@ -29,7 +29,7 @@ Nest is a framework for building efficient, scalable <a href="https://nodejs.org
29
29
 
30
30
  ## Philosophy
31
31
 
32
- <p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front and backend applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a>, and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a>, which improve developer productivity and enable the construction of fast, testable, and extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers, and tools for Node, none of them effectively solve the main problem - the architecture.</p>
32
+ <p>In recent years, thanks to Node.js, JavaScript has become the “lingua franca” of the web for both front-end and back-end applications, giving rise to awesome projects like <a href="https://angular.io/" target="_blank">Angular</a>, <a href="https://github.com/facebook/react" target="_blank">React</a>, and <a href="https://github.com/vuejs/vue" target="_blank">Vue</a>, which improve developer productivity and enable the construction of fast, testable, and extensible frontend applications. However, on the server-side, while there are a lot of superb libraries, helpers, and tools for Node, none of them effectively solve the main problem - the architecture.</p>
33
33
  <p>Nest aims to provide an application architecture out of the box which allows for effortless creation of highly testable, scalable, and loosely coupled and easily maintainable applications. The architecture is heavily inspired by Angular.</p>
34
34
 
35
35
  ## Getting started
@@ -59,5 +59,7 @@ export declare class ExpressAdapter extends AbstractHttpAdapter<http.Server | ht
59
59
  private trackOpenConnections;
60
60
  private closeOpenConnections;
61
61
  private isMiddlewareApplied;
62
+ private setHeaderIfNotExists;
63
+ private applyStreamHeaders;
62
64
  }
63
65
  export {};
@@ -49,19 +49,7 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
49
49
  return response.send();
50
50
  }
51
51
  if (body instanceof common_1.StreamableFile) {
52
- const streamHeaders = body.getHeaders();
53
- if (response.getHeader('Content-Type') === undefined &&
54
- streamHeaders.type !== undefined) {
55
- response.setHeader('Content-Type', streamHeaders.type);
56
- }
57
- if (response.getHeader('Content-Disposition') === undefined &&
58
- streamHeaders.disposition !== undefined) {
59
- response.setHeader('Content-Disposition', streamHeaders.disposition);
60
- }
61
- if (response.getHeader('Content-Length') === undefined &&
62
- streamHeaders.length !== undefined) {
63
- response.setHeader('Content-Length', streamHeaders.length);
64
- }
52
+ this.applyStreamHeaders(response, body);
65
53
  const stream = body.getStream();
66
54
  stream.once('error', err => {
67
55
  body.errorHandler(err, response);
@@ -351,5 +339,17 @@ class ExpressAdapter extends http_adapter_1.AbstractHttpAdapter {
351
339
  (0, shared_utils_1.isFunction)(app.router.stack.filter) &&
352
340
  app.router.stack.some((layer) => layer && layer.handle && layer.handle.name === name));
353
341
  }
342
+ setHeaderIfNotExists(response, name, value) {
343
+ if (value !== undefined && response.getHeader(name) === undefined) {
344
+ const headerValue = Array.isArray(value) ? value.join(',') : value;
345
+ response.setHeader(name, headerValue);
346
+ }
347
+ }
348
+ applyStreamHeaders(response, streamable) {
349
+ const headers = streamable.getHeaders();
350
+ this.setHeaderIfNotExists(response, 'Content-Type', headers.type);
351
+ this.setHeaderIfNotExists(response, 'Content-Disposition', headers.disposition);
352
+ this.setHeaderIfNotExists(response, 'Content-Length', headers.length);
353
+ }
354
354
  }
355
355
  exports.ExpressAdapter = ExpressAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/platform-express",
3
- "version": "11.1.16",
3
+ "version": "11.1.18",
4
4
  "description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
5
5
  "author": "Kamil Mysliwiec",
6
6
  "license": "MIT",
@@ -21,16 +21,16 @@
21
21
  "cors": "2.8.6",
22
22
  "express": "5.2.1",
23
23
  "multer": "2.1.1",
24
- "path-to-regexp": "8.3.0",
24
+ "path-to-regexp": "8.4.2",
25
25
  "tslib": "2.8.1"
26
26
  },
27
27
  "devDependencies": {
28
- "@nestjs/common": "11.1.16",
29
- "@nestjs/core": "11.1.16"
28
+ "@nestjs/common": "11.1.18",
29
+ "@nestjs/core": "11.1.18"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@nestjs/common": "^11.0.0",
33
33
  "@nestjs/core": "^11.0.0"
34
34
  },
35
- "gitHead": "315e698096208868b43dda25f2db9ac9d7c1d822"
35
+ "gitHead": "3c1cc5f91e95fcec27c3694cd42a08a50e85cc5f"
36
36
  }