mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Parse content-type more strictly
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { HttpResponse } from '../../../src/server/HttpResponse';
|
||||
import { BadRequestHttpError } from '../../../src/util/errors/BadRequestHttpError';
|
||||
import {
|
||||
addHeader,
|
||||
parseAccept,
|
||||
@@ -213,6 +214,10 @@ describe('HeaderUtil', (): void => {
|
||||
contentTypePlain.parameters.test = 'value1';
|
||||
expect(parseContentType('text/plain; charset=utf-8;test="value1"')).toEqual(contentTypePlain);
|
||||
});
|
||||
|
||||
it('errors on invalid content-types.', (): void => {
|
||||
expect((): any => parseContentType('invalid type')).toThrow(BadRequestHttpError);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#parseForwarded', (): void => {
|
||||
|
||||
Reference in New Issue
Block a user