Skip to content

Commit

Permalink
fix: send correct Accept header for certain endpoints (#1257)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jan 10, 2025
1 parent 66c9715 commit 8756693
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/resources/audio/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ export class Speech extends APIResource {
* Generates audio from the input text.
*/
create(body: SpeechCreateParams, options?: Core.RequestOptions): Core.APIPromise<Response> {
return this._client.post('/audio/speech', { body, ...options, __binaryResponse: true });
return this._client.post('/audio/speech', {
body,
...options,
headers: { Accept: 'application/octet-stream', ...options?.headers },
__binaryResponse: true,
});
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export class Files extends APIResource {
* Returns the contents of the specified file.
*/
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
return this._client.get(`/files/${fileId}/content`, { ...options, __binaryResponse: true });
return this._client.get(`/files/${fileId}/content`, {
...options,
headers: { Accept: 'application/binary', ...options?.headers },
__binaryResponse: true,
});
}

/**
Expand All @@ -78,10 +82,7 @@ export class Files extends APIResource {
* @deprecated The `.content()` method should be used instead
*/
retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise<string> {
return this._client.get(`/files/${fileId}/content`, {
...options,
headers: { Accept: 'application/json', ...options?.headers },
});
return this._client.get(`/files/${fileId}/content`, options);
}

/**
Expand Down

0 comments on commit 8756693

Please sign in to comment.