Skip to content

Add multipart/form-data build and parse#297

Merged
JE-Chen merged 2 commits into
devfrom
feat/multipart-batch
Jun 21, 2026
Merged

Add multipart/form-data build and parse#297
JE-Chen merged 2 commits into
devfrom
feat/multipart-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

What

Adds file-upload body support. http_request sent only JSON/raw, there was no file upload, and stdlib cgi (which parsed multipart) was removed in Python 3.13.

  • build_multipart(fields, files, *, boundary=None)(content_type, body_bytes); fields as dict or (name, value) list, files as MultipartFile or {name, filename, content, content_type?}. Injectable boundary → byte-stable body.
  • parse_multipart(content_type, body){fields, files}.
  • MultipartFile, new_boundary.

Layers

  • Headless core: utils/multipart/ (pure stdlib re/secrets, zero PySide6).
  • Facade: 4 symbols + __all__.
  • Executor: AC_build_multipart, AC_parse_multipart (body as base64 for JSON safety).
  • MCP: ac_build_multipart, ac_parse_multipart (read-only).
  • Script Builder: both under Data.
  • Tests: test/unit_test/headless/test_multipart_batch.py (9 tests, round-trip).
  • Docs: v89_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

  • pytest test/unit_test/headless/test_multipart_batch.py → 9 passed.
  • ruff check je_auto_control/ clean; pylint 10.00/10; bandit clean; radon CC clean.
  • Package stays Qt-free.

http_request sent only JSON or raw bodies — there was no file upload, and
the stdlib cgi module that once parsed multipart was removed in Python
3.13. Add build_multipart (text fields + files, injectable boundary for a
byte-stable body) and parse_multipart. Wired through facade, executor
(AC_build_multipart / AC_parse_multipart, base64 body), MCP, and the
Script Builder with a headless test batch and EN/Zh docs.
@codacy-production

codacy-production Bot commented Jun 21, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 53 complexity · 0 duplication

Metric Results
Complexity 53
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 1a13154 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/multipart-batch branch June 21, 2026 18:38
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant