Skip to content

Commit c4e6695

Browse files
authored
Merge pull request #2671 from 1000hz/cina/fix-multipart-json
fix: correctly handle sending multipart/form-data requests with JSON
2 parents 83fb4ef + e9deab6 commit c4e6695

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

src/resources/snippets/snippets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class Snippets extends APIResource {
3535
return (
3636
this._client.put(
3737
`/zones/${zone_id}/snippets/${snippetName}`,
38-
Core.multipartFormRequestOptions({ body, ...options }),
38+
Core.multipartFormRequestOptions({ body, ...options, __multipartSyntax: 'json' }),
3939
) as Core.APIPromise<{ result: SnippetUpdateResponse }>
4040
)._thenUnwrap((obj) => obj.result);
4141
}

src/resources/workers-for-platforms/dispatch/namespaces/scripts/content.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class Content extends APIResource {
4141
Core.multipartFormRequestOptions({
4242
body,
4343
...options,
44+
__multipartSyntax: 'json',
4445
headers: {
4546
...(cfWorkerBodyPart != null ? { 'CF-WORKER-BODY-PART': cfWorkerBodyPart } : undefined),
4647
...(cfWorkerMainModulePart != null ?

src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class Settings extends APIResource {
2929
return (
3030
this._client.patch(
3131
`/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/settings`,
32-
Core.multipartFormRequestOptions({ body, ...options }),
32+
Core.multipartFormRequestOptions({ body, ...options, __multipartSyntax: 'json' }),
3333
) as Core.APIPromise<{ result: SettingEditResponse }>
3434
)._thenUnwrap((obj) => obj.result);
3535
}

src/resources/workers/scripts/content.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export class Content extends APIResource {
3737
Core.multipartFormRequestOptions({
3838
body,
3939
...options,
40+
__multipartSyntax: 'json',
4041
headers: {
4142
...(cfWorkerBodyPart != null ? { 'CF-WORKER-BODY-PART': cfWorkerBodyPart } : undefined),
4243
...(cfWorkerMainModulePart != null ?

src/resources/workers/scripts/script-and-version-settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ScriptAndVersionSettings extends APIResource {
2727
return (
2828
this._client.patch(
2929
`/accounts/${account_id}/workers/scripts/${scriptName}/settings`,
30-
Core.multipartFormRequestOptions({ body, ...options }),
30+
Core.multipartFormRequestOptions({ body, ...options, __multipartSyntax: 'json' }),
3131
) as Core.APIPromise<{ result: ScriptAndVersionSettingEditResponse }>
3232
)._thenUnwrap((obj) => obj.result);
3333
}

0 commit comments

Comments
 (0)