Skip to content

Commit

Permalink
Merge pull request #18 from mitre-attack/17-taxii-21-collection-reque…
Browse files Browse the repository at this point in the history
…st-content-type-mismatch-with-client

Wrong media type in content-type response headers
  • Loading branch information
seansica authored Sep 10, 2024
2 parents d5334fa + bc6b1f2 commit 6abe93d
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bruno/Get A Collection.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Get API Root Information.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Get An Object.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Get Collections.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Get Object Manifests.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Get Object Versions.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Get Objects.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
2 changes: 1 addition & 1 deletion bruno/Server Discovery.bru
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
);
Expand Down

0 comments on commit 6abe93d

Please sign in to comment.