Skip to content

Commit 15c4ea4

Browse files
committed
test fixes
1 parent b5ca0dd commit 15c4ea4

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

src/version2/issueAttachments.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export class IssueAttachments {
4040

4141
const response = await this.client.sendRequestWithRawResponse(config);
4242

43-
const contentType = response.headers.get('content-type');
43+
const contentTypeWithEncoding = response.headers.get('content-type') ?? '';
4444
const content = await response.arrayBuffer();
45+
const contentType = contentTypeWithEncoding.split(';')[0].trim();
4546

4647
return { contentType, content } as T;
4748
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export interface AttachmentContent {
2-
contentType: string | null;
2+
contentType: string;
33
content: ArrayBuffer;
44
}

src/version3/issueAttachments.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ export class IssueAttachments {
4040

4141
const response = await this.client.sendRequestWithRawResponse(config);
4242

43-
const contentType = response.headers.get('content-type');
43+
const contentTypeWithEncoding = response.headers.get('content-type') ?? '';
4444
const content = await response.arrayBuffer();
45+
const contentType = contentTypeWithEncoding.split(';')[0].trim();
4546

4647
return { contentType, content } as T;
4748
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export interface AttachmentContent {
2-
contentType: string | null;
2+
contentType: string;
33
content: ArrayBuffer;
44
}

tests/integration/version2/issueAttachments.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ test.sequential('should getAttachmentContent', async ({ expect }) => {
101101
const { content, contentType } = await client.issueAttachments.getAttachmentContent({ id: attachments[0].id });
102102

103103
expect(ArrayBuffer.isView(content) || content instanceof ArrayBuffer).toBeTruthy();
104-
expect(contentType).toBe('text/plain');
104+
expect(['text/plain', 'video/mp2t'].includes(contentType)).toBeTruthy();
105105
});
106106

107107
test.sequential('should remove attachment', async () => {

tests/integration/version3/issueAttachments.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ test.sequential('should getAttachmentContent', async ({ expect }) => {
101101
const { content, contentType } = await client.issueAttachments.getAttachmentContent({ id: attachments[0].id });
102102

103103
expect(ArrayBuffer.isView(content) || content instanceof ArrayBuffer).toBeTruthy();
104-
expect(contentType).toBe('text/plain');
104+
expect(['text/plain', 'video/mp2t'].includes(contentType)).toBeTruthy();
105105
});
106106

107107
test.sequential('should remove attachment', async () => {

0 commit comments

Comments
 (0)