mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: return contenttype header value string with parameters
This commit is contained in:
committed by
Joachim Van Herwegen
parent
e0954cf2a7
commit
311f8756ec
@@ -1,6 +1,6 @@
|
||||
import type { HttpResponse } from '../../../src/server/HttpResponse';
|
||||
import { BadRequestHttpError } from '../../../src/util/errors/BadRequestHttpError';
|
||||
import {
|
||||
import { ContentType,
|
||||
addHeader,
|
||||
hasScheme,
|
||||
matchesAuthorizationScheme,
|
||||
@@ -11,8 +11,7 @@ import {
|
||||
parseAcceptLanguage,
|
||||
parseContentType,
|
||||
parseForwarded,
|
||||
parseLinkHeader,
|
||||
} from '../../../src/util/HeaderUtil';
|
||||
parseLinkHeader } from '../../../src/util/HeaderUtil';
|
||||
|
||||
describe('HeaderUtil', (): void => {
|
||||
describe('#parseAccept', (): void => {
|
||||
@@ -469,4 +468,21 @@ describe('HeaderUtil', (): void => {
|
||||
expect(hasScheme('wss://example.com', 'http', 'WSS')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
describe('A ContentType instance', (): void => {
|
||||
it('can serialize to a correct header value string with parameters.', (): void => {
|
||||
const contentType: ContentType = new ContentType(
|
||||
'text/plain',
|
||||
{
|
||||
charset: 'utf-8',
|
||||
extra: 'test',
|
||||
},
|
||||
);
|
||||
expect(contentType.toHeaderValueString()).toBe('text/plain; charset=utf-8; extra=test');
|
||||
});
|
||||
|
||||
it('can serialize to a correct header value string without parameters.', (): void => {
|
||||
const contentType: ContentType = new ContentType('text/plain');
|
||||
expect(contentType.toHeaderValueString()).toBe('text/plain');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user