@@ -161,6 +161,10 @@ def update(
161161 raise ValueError (f"Expected a non-empty value for `dispatch_namespace` but received { dispatch_namespace !r} " )
162162 if not script_name :
163163 raise ValueError (f"Expected a non-empty value for `script_name` but received { script_name !r} " )
164+ # It should be noted that the actual Content-Type header that will be
165+ # sent to the server will contain a `boundary` parameter, e.g.
166+ # multipart/form-data; boundary=---abc--
167+ extra_headers = {"Content-Type" : "multipart/form-data" , ** (extra_headers or {})}
164168 return self ._put (
165169 f"/accounts/{ account_id } /workers/dispatch/namespaces/{ dispatch_namespace } /scripts/{ script_name } " ,
166170 body = maybe_transform ({"metadata" : metadata }, script_update_params .ScriptUpdateParams ),
@@ -170,6 +174,7 @@ def update(
170174 extra_query = extra_query ,
171175 extra_body = extra_body ,
172176 timeout = timeout ,
177+ multipart_syntax = 'json' ,
173178 post_parser = ResultWrapper [ScriptUpdateResponse ]._unwrapper ,
174179 ),
175180 cast_to = cast (Type [ScriptUpdateResponse ], ResultWrapper [ScriptUpdateResponse ]),
@@ -370,6 +375,10 @@ async def update(
370375 raise ValueError (f"Expected a non-empty value for `dispatch_namespace` but received { dispatch_namespace !r} " )
371376 if not script_name :
372377 raise ValueError (f"Expected a non-empty value for `script_name` but received { script_name !r} " )
378+ # It should be noted that the actual Content-Type header that will be
379+ # sent to the server will contain a `boundary` parameter, e.g.
380+ # multipart/form-data; boundary=---abc--
381+ extra_headers = {"Content-Type" : "multipart/form-data" , ** (extra_headers or {})}
373382 return await self ._put (
374383 f"/accounts/{ account_id } /workers/dispatch/namespaces/{ dispatch_namespace } /scripts/{ script_name } " ,
375384 body = await async_maybe_transform ({"metadata" : metadata }, script_update_params .ScriptUpdateParams ),
@@ -379,6 +388,7 @@ async def update(
379388 extra_query = extra_query ,
380389 extra_body = extra_body ,
381390 timeout = timeout ,
391+ multipart_syntax = 'json' ,
382392 post_parser = ResultWrapper [ScriptUpdateResponse ]._unwrapper ,
383393 ),
384394 cast_to = cast (Type [ScriptUpdateResponse ], ResultWrapper [ScriptUpdateResponse ]),
0 commit comments