Fix multipart/form-data boundary issue in HTTP Call node (#23903)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Guangdong Liu
2025-08-14 10:01:27 +08:00
committed by GitHub
parent cc4d82f932
commit d4756ba659
2 changed files with 19 additions and 8 deletions

View File

@@ -243,8 +243,6 @@ def test_executor_with_form_data():
# Check the executor's data
assert executor.method == "post"
assert executor.url == "https://api.example.com/upload"
assert "Content-Type" in executor.headers
assert "multipart/form-data" in executor.headers["Content-Type"]
assert executor.params is None
assert executor.json is None
# '__multipart_placeholder__' is expected when no file inputs exist,
@@ -252,6 +250,11 @@ def test_executor_with_form_data():
assert executor.files == [("__multipart_placeholder__", ("", b"", "application/octet-stream"))]
assert executor.content is None
# After fix for #23829: When placeholder files exist, Content-Type is removed
# to let httpx handle Content-Type and boundary automatically
headers = executor._assembling_headers()
assert "Content-Type" not in headers or "multipart/form-data" not in headers.get("Content-Type", "")
# Check that the form data is correctly loaded in executor.data
assert isinstance(executor.data, dict)
assert "text_field" in executor.data