Skip to content

Commit 5513531

Browse files
committed
fix: keep extra_body out of deployment JSON part extraction
1 parent 133d738 commit 5513531

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/kernel/resources/deployments.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, Dict, Mapping, cast
5+
from typing import Any, Dict, cast
66
from typing_extensions import Literal
77

88
import httpx
@@ -31,9 +31,7 @@
3131
__all__ = ["DeploymentsResource", "AsyncDeploymentsResource"]
3232

3333

34-
def _extract_json_parts(body: dict[str, object], extra_body: Body | None) -> list[tuple[str, FileTypes]]:
35-
if extra_body is not None:
36-
body.update(cast(Mapping[str, object], extra_body))
34+
def _extract_json_parts(body: dict[str, object]) -> list[tuple[str, FileTypes]]:
3735
return [
3836
(name, (None, openapi_dumps(body.pop(name)), "application/json"))
3937
for name in ("source", "runtime_policy")
@@ -138,7 +136,7 @@ def create(
138136
)
139137
files = extract_files(body, paths=[["file"]])
140138
body = transform(body, deployment_create_params.DeploymentCreateParams)
141-
files.extend(_extract_json_parts(body, extra_body))
139+
files.extend(_extract_json_parts(body))
142140
# It should be noted that the actual Content-Type header that will be
143141
# sent to the server will contain a `boundary` parameter, e.g.
144142
# multipart/form-data; boundary=---abc--
@@ -150,6 +148,7 @@ def create(
150148
options=make_request_options(
151149
extra_headers=extra_headers,
152150
extra_query=extra_query,
151+
extra_body=extra_body,
153152
timeout=timeout,
154153
idempotency_key=idempotency_key,
155154
),
@@ -437,7 +436,7 @@ async def create(
437436
)
438437
files = extract_files(body, paths=[["file"]])
439438
body = await async_transform(body, deployment_create_params.DeploymentCreateParams)
440-
files.extend(_extract_json_parts(body, extra_body))
439+
files.extend(_extract_json_parts(body))
441440
# It should be noted that the actual Content-Type header that will be
442441
# sent to the server will contain a `boundary` parameter, e.g.
443442
# multipart/form-data; boundary=---abc--
@@ -449,6 +448,7 @@ async def create(
449448
options=make_request_options(
450449
extra_headers=extra_headers,
451450
extra_query=extra_query,
451+
extra_body=extra_body,
452452
timeout=timeout,
453453
idempotency_key=idempotency_key,
454454
),

0 commit comments

Comments
 (0)