diff --git a/src/common/middleware/content-negotiation/supported-media-types.ts b/src/common/middleware/content-negotiation/supported-media-types.ts index a1f53fa..dfb7215 100644 --- a/src/common/middleware/content-negotiation/supported-media-types.ts +++ b/src/common/middleware/content-negotiation/supported-media-types.ts @@ -1,12 +1,14 @@ export enum SupportedMediaTypes { - "application" = "application", + Application = "application", } export enum SupportedMediaSubTypes { - "taxii+json" = "taxii+json", + TaxiiJson = "taxii+json", } export enum SupportedMediaVersion { V21 = "2.1", LATEST = "2.1", } + +export const DEFAULT_CONTENT_TYPE = `${SupportedMediaTypes.Application}/${SupportedMediaSubTypes.TaxiiJson};version=${SupportedMediaVersion.LATEST}` as const; diff --git a/src/taxii/providers/discovery/discovery.service.ts b/src/taxii/providers/discovery/discovery.service.ts index f530f52..c1da05d 100644 --- a/src/taxii/providers/discovery/discovery.service.ts +++ b/src/taxii/providers/discovery/discovery.service.ts @@ -1,6 +1,7 @@ import { Injectable } from "@nestjs/common"; import { TaxiiConfigService } from "src/config"; import { DiscoverOptions, DiscoveryDto, ApiRootDto } from "./dto"; +import { DEFAULT_CONTENT_TYPE } from "src/common/middleware/content-negotiation/supported-media-types"; @Injectable() export class DiscoveryService { @@ -22,9 +23,9 @@ export class DiscoveryService { return new ApiRootDto({ title: this.config.API_ROOT_TITLE, description: this.config.API_ROOT_DESCRIPTION, - version: "application/taxii+json;version=2.1", // ** A value of "application/taxii+json;version=2.1" MUST - // be included in this list to indicate conformance with - // this specification. ** // + versions: [ + DEFAULT_CONTENT_TYPE, // ** A value of "application/taxii+json;version=2.1" MUST be included in this list to indicate conformance with this specification. ** // + ], maxContentLength: this.config.MAX_CONTENT_LENGTH, }); }