@tsed/swagger 7.61.2 → 7.62.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.
@@ -41,7 +41,7 @@ let SwaggerModule = class SwaggerModule {
41
41
  const urls = this.getUrls();
42
42
  this.settings.forEach((conf) => {
43
43
  const { path = "/" } = conf;
44
- this.app.get(path, (0, platform_router_1.useContextHandler)((0, redirectMiddleware_1.redirectMiddleware)(path)));
44
+ this.app.use(path, (0, platform_router_1.useContextHandler)((0, redirectMiddleware_1.redirectMiddleware)(path)));
45
45
  this.app.use(path, this.createRouter(conf, urls));
46
46
  });
47
47
  this.loaded = true;
@@ -7,7 +7,7 @@ exports.redirectMiddleware = void 0;
7
7
  */
8
8
  function redirectMiddleware(path) {
9
9
  return (ctx) => {
10
- if (ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
10
+ if (ctx.request.method?.toUpperCase() === "GET" && ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
11
11
  ctx.response.redirect(302, `${path}/`);
12
12
  }
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC7D,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC;AAND,gDAMC"}
1
+ {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5G,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC;AAND,gDAMC"}
@@ -38,7 +38,7 @@ let SwaggerModule = class SwaggerModule {
38
38
  const urls = this.getUrls();
39
39
  this.settings.forEach((conf) => {
40
40
  const { path = "/" } = conf;
41
- this.app.get(path, useContextHandler(redirectMiddleware(path)));
41
+ this.app.use(path, useContextHandler(redirectMiddleware(path)));
42
42
  this.app.use(path, this.createRouter(conf, urls));
43
43
  });
44
44
  this.loaded = true;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export function redirectMiddleware(path) {
6
6
  return (ctx) => {
7
- if (ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
7
+ if (ctx.request.method?.toUpperCase() === "GET" && ctx.request.url === path && !ctx.request.url.match(/\/$/)) {
8
8
  ctx.response.redirect(302, `${path}/`);
9
9
  }
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC7D,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"redirectMiddleware.js","sourceRoot":"","sources":["../../../src/middlewares/redirectMiddleware.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CAAC,GAAoB,EAAE,EAAE;QAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC5G,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;SACxC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/swagger",
3
- "version": "7.61.2",
3
+ "version": "7.62.0",
4
4
  "description": "Swagger package for Ts.ED framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/cjs/index.js",
@@ -21,8 +21,8 @@
21
21
  "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json"
22
22
  },
23
23
  "dependencies": {
24
- "@tsed/normalize-path": "7.61.2",
25
- "@tsed/openspec": "7.61.2",
24
+ "@tsed/normalize-path": "7.62.0",
25
+ "@tsed/openspec": "7.62.0",
26
26
  "filedirname": "^2.7.0",
27
27
  "fs-extra": "11.1.1",
28
28
  "micromatch": "4.0.5",
@@ -30,20 +30,20 @@
30
30
  "tslib": "2.6.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@tsed/common": "7.61.2",
34
- "@tsed/core": "7.61.2",
35
- "@tsed/di": "7.61.2",
36
- "@tsed/json-mapper": "7.61.2",
37
- "@tsed/openspec": "7.61.2",
38
- "@tsed/schema": "7.61.2",
39
- "@tsed/typescript": "7.61.2",
33
+ "@tsed/common": "7.62.0",
34
+ "@tsed/core": "7.62.0",
35
+ "@tsed/di": "7.62.0",
36
+ "@tsed/json-mapper": "7.62.0",
37
+ "@tsed/openspec": "7.62.0",
38
+ "@tsed/schema": "7.62.0",
39
+ "@tsed/typescript": "7.62.0",
40
40
  "@types/swagger-ui-dist": ">=3.30.1",
41
41
  "barrelsby": "^2.8.1",
42
42
  "eslint": "^8.12.0",
43
43
  "jest": "^29.2.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "@tsed/common": "7.61.2"
46
+ "@tsed/common": "7.62.0"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@tsed/common": {