From e9628313cf92ebcf58392b5523f3527f8051bb4c Mon Sep 17 00:00:00 2001 From: Sean Sica <23294618+seansica@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:01:33 -0400 Subject: [PATCH 1/3] fix: verify response content type is taxii+json not stix+json --- bruno/Get A Collection.bru | 2 +- bruno/Get API Root Information.bru | 2 +- bruno/Get An Object.bru | 2 +- bruno/Get Collections.bru | 2 +- bruno/Get Object Manifests.bru | 2 +- bruno/Get Object Versions.bru | 2 +- bruno/Get Objects.bru | 2 +- bruno/Server Discovery.bru | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bruno/Get A Collection.bru b/bruno/Get A Collection.bru index 1a79216..22b407c 100644 --- a/bruno/Get A Collection.bru +++ b/bruno/Get A Collection.bru @@ -26,7 +26,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Get API Root Information.bru b/bruno/Get API Root Information.bru index f648a20..dc90915 100644 --- a/bruno/Get API Root Information.bru +++ b/bruno/Get API Root Information.bru @@ -21,7 +21,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Get An Object.bru b/bruno/Get An Object.bru index 1f0d441..f12caa2 100644 --- a/bruno/Get An Object.bru +++ b/bruno/Get An Object.bru @@ -28,7 +28,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Get Collections.bru b/bruno/Get Collections.bru index 4f0d8b3..2fa99a3 100644 --- a/bruno/Get Collections.bru +++ b/bruno/Get Collections.bru @@ -21,7 +21,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Get Object Manifests.bru b/bruno/Get Object Manifests.bru index 0427944..1c46823 100644 --- a/bruno/Get Object Manifests.bru +++ b/bruno/Get Object Manifests.bru @@ -25,7 +25,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Get Object Versions.bru b/bruno/Get Object Versions.bru index b58e6c2..ddba14d 100644 --- a/bruno/Get Object Versions.bru +++ b/bruno/Get Object Versions.bru @@ -30,7 +30,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Get Objects.bru b/bruno/Get Objects.bru index 277c4e3..37d7ac1 100644 --- a/bruno/Get Objects.bru +++ b/bruno/Get Objects.bru @@ -37,7 +37,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); diff --git a/bruno/Server Discovery.bru b/bruno/Server Discovery.bru index 1b0e4f0..067ca2b 100644 --- a/bruno/Server Discovery.bru +++ b/bruno/Server Discovery.bru @@ -21,7 +21,7 @@ tests { test("Verify response content type", function() { const contentType = res.getHeader('content-type'); - expect(contentType).to.include('application/stix+json'); + expect(contentType).to.include('application/taxii+json'); expect(contentType).to.include('version=2.1'); }); From 69f33bddcd0d5305238aafc0614681619b05c89b Mon Sep 17 00:00:00 2001 From: Sean Sica <23294618+seansica@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:02:23 -0400 Subject: [PATCH 2/3] fix: comment out portion of SetResponseMediaType interceptor that replaces 'taxii' with 'stix' --- .../interceptors/set-response-media-type.interceptor.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/interceptors/set-response-media-type.interceptor.ts b/src/common/interceptors/set-response-media-type.interceptor.ts index d5ed332..783db0d 100644 --- a/src/common/interceptors/set-response-media-type.interceptor.ts +++ b/src/common/interceptors/set-response-media-type.interceptor.ts @@ -24,10 +24,10 @@ export class SetResponseMediaType implements NestInterceptor { const requestedMediaType: MediaTypeObject = req[MEDIA_TYPE_TOKEN]; - requestedMediaType._subType = requestedMediaType._subType.replace( - "taxii", - "stix" - ); + // requestedMediaType._subType = requestedMediaType._subType.replace( + // "taxii", + // "stix" + // ); const contentType = requestedMediaType.toString(); From bc6b1f25ee1476de867614452734afdd14a1747c Mon Sep 17 00:00:00 2001 From: Sean Sica <23294618+seansica@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:58:08 -0400 Subject: [PATCH 3/3] fix: remove portion of SetResponseMediaType interceptor that replaces 'taxii' with 'stix' --- .../interceptors/set-response-media-type.interceptor.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/common/interceptors/set-response-media-type.interceptor.ts b/src/common/interceptors/set-response-media-type.interceptor.ts index 783db0d..6d8269e 100644 --- a/src/common/interceptors/set-response-media-type.interceptor.ts +++ b/src/common/interceptors/set-response-media-type.interceptor.ts @@ -24,15 +24,8 @@ export class SetResponseMediaType implements NestInterceptor { const requestedMediaType: MediaTypeObject = req[MEDIA_TYPE_TOKEN]; - // requestedMediaType._subType = requestedMediaType._subType.replace( - // "taxii", - // "stix" - // ); - const contentType = requestedMediaType.toString(); - contentType.replace("taxii", "stix"); - res.setHeader("Content-Type", contentType); }) );