fix: Rename UnsupportedHttpError into BadRequestError.

This commit is contained in:
Ruben Verborgh
2020-11-27 10:25:05 +01:00
committed by Joachim Van Herwegen
parent 03ffaaed43
commit af8f1976cd
53 changed files with 177 additions and 171 deletions

View File

@@ -1,6 +1,6 @@
import type { ResourceStore } from '../../../../src/storage/ResourceStore';
import { RegexRouterRule } from '../../../../src/storage/routing/RegexRouterRule';
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
import { BadRequestHttpError } from '../../../../src/util/errors/BadRequestHttpError';
describe('A RegexRouterRule', (): void => {
const base = 'http://test.com/';
@@ -9,13 +9,13 @@ describe('A RegexRouterRule', (): void => {
it('rejects identifiers not containing the base.', async(): Promise<void> => {
const router = new RegexRouterRule(base, {});
await expect(router.canHandle({ identifier: { path: 'http://notTest.com/apple' }}))
.rejects.toThrow(new UnsupportedHttpError(`Identifiers need to start with http://test.com`));
.rejects.toThrow(new BadRequestHttpError(`Identifiers need to start with http://test.com`));
});
it('rejects identifiers not matching any regex.', async(): Promise<void> => {
const router = new RegexRouterRule(base, { pear: store });
await expect(router.canHandle({ identifier: { path: `${base}apple/` }}))
.rejects.toThrow(new UnsupportedHttpError(`No stored regexes match http://test.com/apple/`));
.rejects.toThrow(new BadRequestHttpError(`No stored regexes match http://test.com/apple/`));
});
it('accepts identifiers matching any regex.', async(): Promise<void> => {