From 54a9066f6ad3fc771f3bd6aace30d14092aa4b73 Mon Sep 17 00:00:00 2001 From: Sean Sica <23294618+seansica@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:55:20 -0400 Subject: [PATCH] fix: update supported media types --- .../content-negotiation/supported-media-types.ts | 6 ++++-- src/taxii/providers/discovery/discovery.service.ts | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) 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, }); }