mirror of
https://github.com/strapi/strapi.git
synced 2025-12-04 19:13:20 +00:00
fix: http-errors ugprade
This commit is contained in:
parent
c5892a9f22
commit
06f017a9dc
@ -111,6 +111,7 @@
|
|||||||
"@types/bcryptjs": "2.4.3",
|
"@types/bcryptjs": "2.4.3",
|
||||||
"@types/configstore": "5.0.1",
|
"@types/configstore": "5.0.1",
|
||||||
"@types/delegates": "1.0.0",
|
"@types/delegates": "1.0.0",
|
||||||
|
"@types/http-errors": "2.0.4",
|
||||||
"@types/jest": "29.5.2",
|
"@types/jest": "29.5.2",
|
||||||
"@types/koa": "2.13.4",
|
"@types/koa": "2.13.4",
|
||||||
"@types/koa-compress": "4.0.3",
|
"@types/koa-compress": "4.0.3",
|
||||||
|
|||||||
@ -23,8 +23,9 @@ const addCustomMethods = (app: Koa) => {
|
|||||||
.filter((code) => code >= 400 && code < 600)
|
.filter((code) => code >= 400 && code < 600)
|
||||||
.forEach((code) => {
|
.forEach((code) => {
|
||||||
const name = statuses(code);
|
const name = statuses(code);
|
||||||
|
|
||||||
const camelCasedName = camelCase(name);
|
const camelCasedName = camelCase(name);
|
||||||
app.response[camelCasedName] = function responseCode(message, details = {}) {
|
app.response[camelCasedName] = function responseCode(message = name, details = {}) {
|
||||||
const httpError = createError(code, message, { details });
|
const httpError = createError(code, message, { details });
|
||||||
const { status, body } = formatHttpError(httpError);
|
const { status, body } = formatHttpError(httpError);
|
||||||
this.status = status;
|
this.status = status;
|
||||||
|
|||||||
@ -145,22 +145,17 @@
|
|||||||
"esbuild-loader": "^2.21.0",
|
"esbuild-loader": "^2.21.0",
|
||||||
"esbuild-register": "3.5.0",
|
"esbuild-register": "3.5.0",
|
||||||
"execa": "5.1.1",
|
"execa": "5.1.1",
|
||||||
"find-root": "1.1.0",
|
|
||||||
"fork-ts-checker-webpack-plugin": "8.0.0",
|
"fork-ts-checker-webpack-plugin": "8.0.0",
|
||||||
"fs-extra": "11.2.0",
|
"fs-extra": "11.2.0",
|
||||||
"get-latest-version": "5.1.0",
|
"get-latest-version": "5.1.0",
|
||||||
"git-url-parse": "14.0.0",
|
"git-url-parse": "14.0.0",
|
||||||
"glob": "10.3.10",
|
|
||||||
"html-webpack-plugin": "5.6.0",
|
"html-webpack-plugin": "5.6.0",
|
||||||
"http-errors": "2.0.0",
|
|
||||||
"https-proxy-agent": "5.0.1",
|
|
||||||
"inquirer": "8.2.5",
|
"inquirer": "8.2.5",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"mini-css-extract-plugin": "2.7.7",
|
"mini-css-extract-plugin": "2.7.7",
|
||||||
"nodemon": "3.0.2",
|
"nodemon": "3.0.2",
|
||||||
"ora": "5.4.1",
|
"ora": "5.4.1",
|
||||||
"outdent": "0.8.0",
|
"outdent": "0.8.0",
|
||||||
"package-json": "7.0.0",
|
|
||||||
"pkg-up": "3.1.0",
|
"pkg-up": "3.1.0",
|
||||||
"prettier": "3.2.5",
|
"prettier": "3.2.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
@ -181,10 +176,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@strapi/ts-zen": "^0.2.0",
|
"@strapi/ts-zen": "^0.2.0",
|
||||||
"@types/bcryptjs": "2.4.3",
|
|
||||||
"@types/configstore": "5.0.1",
|
|
||||||
"@types/delegates": "1.0.0",
|
|
||||||
"@types/find-root": "1.1.4",
|
|
||||||
"@types/jest": "29.5.2",
|
"@types/jest": "29.5.2",
|
||||||
"@types/lodash": "^4.14.191",
|
"@types/lodash": "^4.14.191",
|
||||||
"@types/node": "18.19.24",
|
"@types/node": "18.19.24",
|
||||||
|
|||||||
@ -57,6 +57,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@strapi/pack-up": "5.0.0",
|
"@strapi/pack-up": "5.0.0",
|
||||||
|
"@types/http-errors": "2.0.4",
|
||||||
"@types/koa": "2.13.4",
|
"@types/koa": "2.13.4",
|
||||||
"@types/node": "18.19.24",
|
"@types/node": "18.19.24",
|
||||||
"eslint-config-custom": "5.0.0-beta.5",
|
"eslint-config-custom": "5.0.0-beta.5",
|
||||||
|
|||||||
29
yarn.lock
29
yarn.lock
@ -7276,6 +7276,7 @@ __metadata:
|
|||||||
"@types/bcryptjs": "npm:2.4.3"
|
"@types/bcryptjs": "npm:2.4.3"
|
||||||
"@types/configstore": "npm:5.0.1"
|
"@types/configstore": "npm:5.0.1"
|
||||||
"@types/delegates": "npm:1.0.0"
|
"@types/delegates": "npm:1.0.0"
|
||||||
|
"@types/http-errors": "npm:2.0.4"
|
||||||
"@types/jest": "npm:29.5.2"
|
"@types/jest": "npm:29.5.2"
|
||||||
"@types/koa": "npm:2.13.4"
|
"@types/koa": "npm:2.13.4"
|
||||||
"@types/koa-compress": "npm:4.0.3"
|
"@types/koa-compress": "npm:4.0.3"
|
||||||
@ -8176,10 +8177,6 @@ __metadata:
|
|||||||
"@strapi/types": "npm:5.0.0-beta.5"
|
"@strapi/types": "npm:5.0.0-beta.5"
|
||||||
"@strapi/typescript-utils": "npm:5.0.0-beta.5"
|
"@strapi/typescript-utils": "npm:5.0.0-beta.5"
|
||||||
"@strapi/utils": "npm:5.0.0-beta.5"
|
"@strapi/utils": "npm:5.0.0-beta.5"
|
||||||
"@types/bcryptjs": "npm:2.4.3"
|
|
||||||
"@types/configstore": "npm:5.0.1"
|
|
||||||
"@types/delegates": "npm:1.0.0"
|
|
||||||
"@types/find-root": "npm:1.1.4"
|
|
||||||
"@types/jest": "npm:29.5.2"
|
"@types/jest": "npm:29.5.2"
|
||||||
"@types/lodash": "npm:^4.14.191"
|
"@types/lodash": "npm:^4.14.191"
|
||||||
"@types/node": "npm:18.19.24"
|
"@types/node": "npm:18.19.24"
|
||||||
@ -8203,22 +8200,17 @@ __metadata:
|
|||||||
esbuild-register: "npm:3.5.0"
|
esbuild-register: "npm:3.5.0"
|
||||||
eslint-config-custom: "npm:5.0.0-beta.5"
|
eslint-config-custom: "npm:5.0.0-beta.5"
|
||||||
execa: "npm:5.1.1"
|
execa: "npm:5.1.1"
|
||||||
find-root: "npm:1.1.0"
|
|
||||||
fork-ts-checker-webpack-plugin: "npm:8.0.0"
|
fork-ts-checker-webpack-plugin: "npm:8.0.0"
|
||||||
fs-extra: "npm:11.2.0"
|
fs-extra: "npm:11.2.0"
|
||||||
get-latest-version: "npm:5.1.0"
|
get-latest-version: "npm:5.1.0"
|
||||||
git-url-parse: "npm:14.0.0"
|
git-url-parse: "npm:14.0.0"
|
||||||
glob: "npm:10.3.10"
|
|
||||||
html-webpack-plugin: "npm:5.6.0"
|
html-webpack-plugin: "npm:5.6.0"
|
||||||
http-errors: "npm:2.0.0"
|
|
||||||
https-proxy-agent: "npm:5.0.1"
|
|
||||||
inquirer: "npm:8.2.5"
|
inquirer: "npm:8.2.5"
|
||||||
lodash: "npm:4.17.21"
|
lodash: "npm:4.17.21"
|
||||||
mini-css-extract-plugin: "npm:2.7.7"
|
mini-css-extract-plugin: "npm:2.7.7"
|
||||||
nodemon: "npm:3.0.2"
|
nodemon: "npm:3.0.2"
|
||||||
ora: "npm:5.4.1"
|
ora: "npm:5.4.1"
|
||||||
outdent: "npm:0.8.0"
|
outdent: "npm:0.8.0"
|
||||||
package-json: "npm:7.0.0"
|
|
||||||
pkg-up: "npm:3.1.0"
|
pkg-up: "npm:3.1.0"
|
||||||
prettier: "npm:3.2.5"
|
prettier: "npm:3.2.5"
|
||||||
react: "npm:^18.2.0"
|
react: "npm:^18.2.0"
|
||||||
@ -8367,6 +8359,7 @@ __metadata:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@sindresorhus/slugify": "npm:1.1.0"
|
"@sindresorhus/slugify": "npm:1.1.0"
|
||||||
"@strapi/pack-up": "npm:5.0.0"
|
"@strapi/pack-up": "npm:5.0.0"
|
||||||
|
"@types/http-errors": "npm:2.0.4"
|
||||||
"@types/koa": "npm:2.13.4"
|
"@types/koa": "npm:2.13.4"
|
||||||
"@types/node": "npm:18.19.24"
|
"@types/node": "npm:18.19.24"
|
||||||
date-fns: "npm:2.30.0"
|
date-fns: "npm:2.30.0"
|
||||||
@ -8970,13 +8963,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/find-root@npm:1.1.4":
|
|
||||||
version: 1.1.4
|
|
||||||
resolution: "@types/find-root@npm:1.1.4"
|
|
||||||
checksum: e438c62b3ef3b706d058764797ec5227479ed4be98e9fec5456fb3b9a2096ccd3e35a84c94e2018278e22c651f12ae6ff4d6d7006b09fa5132da3612e2118076
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@types/fined@npm:*":
|
"@types/fined@npm:*":
|
||||||
version: 1.1.3
|
version: 1.1.3
|
||||||
resolution: "@types/fined@npm:1.1.3"
|
resolution: "@types/fined@npm:1.1.3"
|
||||||
@ -9076,6 +9062,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/http-errors@npm:2.0.4":
|
||||||
|
version: 2.0.4
|
||||||
|
resolution: "@types/http-errors@npm:2.0.4"
|
||||||
|
checksum: 1f3d7c3b32c7524811a45690881736b3ef741bf9849ae03d32ad1ab7062608454b150a4e7f1351f83d26a418b2d65af9bdc06198f1c079d75578282884c4e8e3
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/inquirer@npm:^6.5.0":
|
"@types/inquirer@npm:^6.5.0":
|
||||||
version: 6.5.0
|
version: 6.5.0
|
||||||
resolution: "@types/inquirer@npm:6.5.0"
|
resolution: "@types/inquirer@npm:6.5.0"
|
||||||
@ -16369,7 +16362,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"find-root@npm:1.1.0, find-root@npm:^1.1.0":
|
"find-root@npm:^1.1.0":
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
resolution: "find-root@npm:1.1.0"
|
resolution: "find-root@npm:1.1.0"
|
||||||
checksum: caa799c976a14925ba7f31ca1a226fe73d3aa270f4f1b623fcfeb1c6e263111db4beb807d8acd31bd4d48d44c343b93688a9288dfbccca27463c36a0301b0bb9
|
checksum: caa799c976a14925ba7f31ca1a226fe73d3aa270f4f1b623fcfeb1c6e263111db4beb807d8acd31bd4d48d44c343b93688a9288dfbccca27463c36a0301b0bb9
|
||||||
@ -18100,7 +18093,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"https-proxy-agent@npm:5.0.1, https-proxy-agent@npm:^5.0.0, https-proxy-agent@npm:^5.0.1":
|
"https-proxy-agent@npm:^5.0.0, https-proxy-agent@npm:^5.0.1":
|
||||||
version: 5.0.1
|
version: 5.0.1
|
||||||
resolution: "https-proxy-agent@npm:5.0.1"
|
resolution: "https-proxy-agent@npm:5.0.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user