Skip to content

Commit 3c830fe

Browse files
stainless-botRobertCraigie
authored andcommitted
fix: send correct Accept header for certain endpoints
chore: unknown commit message
1 parent 44ea0ad commit 3c830fe

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/resources/audio/speech.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ export class Speech extends APIResource {
99
* Generates audio from the input text.
1010
*/
1111
create(body: SpeechCreateParams, options?: RequestOptions): APIPromise<Response> {
12-
return this._client.post('/audio/speech', { body, ...options, __binaryResponse: true });
12+
return this._client.post('/audio/speech', {
13+
body,
14+
...options,
15+
headers: { Accept: 'application/octet-stream', ...options?.headers },
16+
__binaryResponse: true,
17+
});
1318
}
1419
}
1520

src/resources/files.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ export class Files extends APIResource {
6464
* Returns the contents of the specified file.
6565
*/
6666
content(fileID: string, options?: RequestOptions): APIPromise<Response> {
67-
return this._client.get(`/files/${fileID}/content`, { ...options, __binaryResponse: true });
67+
return this._client.get(`/files/${fileID}/content`, {
68+
...options,
69+
headers: { Accept: 'application/binary', ...options?.headers },
70+
__binaryResponse: true,
71+
});
6872
}
6973

7074
/**
@@ -73,10 +77,7 @@ export class Files extends APIResource {
7377
* @deprecated The `.content()` method should be used instead
7478
*/
7579
retrieveContent(fileID: string, options?: RequestOptions): APIPromise<string> {
76-
return this._client.get(`/files/${fileID}/content`, {
77-
...options,
78-
headers: { Accept: 'application/json', ...options?.headers },
79-
});
80+
return this._client.get(`/files/${fileID}/content`, options);
8081
}
8182

8283
/**

0 commit comments

Comments
 (0)