Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/resources/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export class Files extends APIResource {
* Upload file
*/
upload(params: FileUploadParams, options?: Core.RequestOptions): Core.APIPromise<File> {
const { content, 'Content-Disposition': contentDisposition, 'Content-Type': contentType } = params;
const { content, 'Content-Disposition': contentDisposition } = params;
return this._client.post('/v1/files', {
body: content,
...options,
headers: {
'Content-Type': contentType,
'Content-Type': 'text/plain',
'Content-Disposition': contentDisposition,
...options?.headers,
},
Expand Down Expand Up @@ -128,11 +128,6 @@ export interface FileUploadParams {
* form-data name.
*/
'Content-Disposition': string;

/**
* Header param: The MIME type of the file being uploaded.
*/
'Content-Type': string;
}

export namespace Files {
Expand Down
2 changes: 0 additions & 2 deletions tests/api-resources/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('resource files', () => {
const responsePromise = client.files.upload({
content: await toFile(Buffer.from('# my file contents'), 'README.md'),
'Content-Disposition': 'Content-Disposition',
'Content-Type': 'Content-Type',
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
Expand All @@ -108,7 +107,6 @@ describe('resource files', () => {
const response = await client.files.upload({
content: await toFile(Buffer.from('# my file contents'), 'README.md'),
'Content-Disposition': 'Content-Disposition',
'Content-Type': 'Content-Type',
});
});
});