mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore(deps): update dependency http-errors to ^2.0.0 (#3785)
Co-authored-by: Gao Sun <gao@silverhand.io>
This commit is contained in:
parent
13d9acdb8b
commit
f4f8224ff9
3 changed files with 6 additions and 10 deletions
|
@ -85,7 +85,6 @@
|
||||||
"@silverhand/ts-config": "3.0.0",
|
"@silverhand/ts-config": "3.0.0",
|
||||||
"@types/debug": "^4.1.7",
|
"@types/debug": "^4.1.7",
|
||||||
"@types/etag": "^1.8.1",
|
"@types/etag": "^1.8.1",
|
||||||
"@types/http-errors": "^1.8.2",
|
|
||||||
"@types/jest": "^29.4.0",
|
"@types/jest": "^29.4.0",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/koa": "^2.13.3",
|
"@types/koa": "^2.13.3",
|
||||||
|
@ -102,7 +101,6 @@
|
||||||
"@types/supertest": "^2.0.11",
|
"@types/supertest": "^2.0.11",
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"eslint": "^8.34.0",
|
"eslint": "^8.34.0",
|
||||||
"http-errors": "^1.6.3",
|
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"jest-matcher-specific-error": "^1.0.0",
|
"jest-matcher-specific-error": "^1.0.0",
|
||||||
"lint-staged": "^13.0.0",
|
"lint-staged": "^13.0.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import createHttpError from 'http-errors';
|
import { HttpError } from 'koa';
|
||||||
|
|
||||||
import RequestError from '#src/errors/RequestError/index.js';
|
import RequestError from '#src/errors/RequestError/index.js';
|
||||||
import createMockContext from '#src/test-utils/jest-koa-mocks/create-mock-context.js';
|
import createMockContext from '#src/test-utils/jest-koa-mocks/create-mock-context.js';
|
||||||
|
@ -7,6 +7,10 @@ import koaErrorHandler from './koa-error-handler.js';
|
||||||
|
|
||||||
const { jest } = import.meta;
|
const { jest } = import.meta;
|
||||||
|
|
||||||
|
// Avoid "TypeError: cannot construct abstract class"
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument
|
||||||
|
const httpError = Object.create(HttpError.prototype);
|
||||||
|
|
||||||
describe('koaErrorHandler middleware', () => {
|
describe('koaErrorHandler middleware', () => {
|
||||||
const mockBody = { data: 'foo' };
|
const mockBody = { data: 'foo' };
|
||||||
|
|
||||||
|
@ -37,7 +41,7 @@ describe('koaErrorHandler middleware', () => {
|
||||||
|
|
||||||
// Koa will handle `HttpError` with a built-in manner. Hence it needs to return 200 here.
|
// Koa will handle `HttpError` with a built-in manner. Hence it needs to return 200 here.
|
||||||
it('expect to return 200 if error type is HttpError', async () => {
|
it('expect to return 200 if error type is HttpError', async () => {
|
||||||
next.mockRejectedValueOnce(createHttpError(404, 'not good'));
|
next.mockRejectedValueOnce(httpError);
|
||||||
await koaErrorHandler()(ctx, next);
|
await koaErrorHandler()(ctx, next);
|
||||||
expect(ctx.status).toEqual(200);
|
expect(ctx.status).toEqual(200);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3219,9 +3219,6 @@ importers:
|
||||||
'@types/etag':
|
'@types/etag':
|
||||||
specifier: ^1.8.1
|
specifier: ^1.8.1
|
||||||
version: 1.8.1
|
version: 1.8.1
|
||||||
'@types/http-errors':
|
|
||||||
specifier: ^1.8.2
|
|
||||||
version: 1.8.2
|
|
||||||
'@types/jest':
|
'@types/jest':
|
||||||
specifier: ^29.4.0
|
specifier: ^29.4.0
|
||||||
version: 29.4.0
|
version: 29.4.0
|
||||||
|
@ -3270,9 +3267,6 @@ importers:
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^8.34.0
|
specifier: ^8.34.0
|
||||||
version: 8.34.0
|
version: 8.34.0
|
||||||
http-errors:
|
|
||||||
specifier: ^1.6.3
|
|
||||||
version: 1.8.1
|
|
||||||
jest:
|
jest:
|
||||||
specifier: ^29.5.0
|
specifier: ^29.5.0
|
||||||
version: 29.5.0(@types/node@18.11.18)
|
version: 29.5.0(@types/node@18.11.18)
|
||||||
|
|
Loading…
Reference in a new issue