Skip to content

Add HTTP content negotiation and response decompression#298

Merged
JE-Chen merged 1 commit into
devfrom
feat/http-content-batch
Jun 21, 2026
Merged

Add HTTP content negotiation and response decompression#298
JE-Chen merged 1 commit into
devfrom
feat/http-content-batch

Conversation

@JE-Chen

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

Copy link
Copy Markdown
Member

What

urllib/http_request never set Accept-Encoding nor decoded Content-Encoding, so compressed bodies arrived raw, and there was no quality-value parser.

  • build_accept(types) / build_accept_encoding() — header builders.
  • parse_quality_values(header)(token, q) sorted by quality (ties keep order).
  • decode_body(headers, raw) — gzip / deflate (incl. raw deflate) / identity; ValueError for unsupported. Brotli excluded (not stdlib).
  • negotiated_call(call, ...) — adds negotiation headers to a build_call dict.

Layers

  • Headless core: utils/http_content/ (pure stdlib gzip/zlib, zero PySide6).
  • Facade: 5 symbols + __all__.
  • Executor: AC_decode_body (base64), AC_parse_quality_values.
  • MCP: ac_decode_body, ac_parse_quality_values (read-only).
  • Script Builder: both under Data.
  • Tests: test/unit_test/headless/test_http_content_batch.py (10 tests).
  • Docs: v90_features_doc.rst (EN + Zh) + toctrees + 3 README What's-new sections.

Verification

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

urllib/http_request never set Accept-Encoding nor decoded Content-Encoding,
so compressed bodies arrived raw, and there was no quality-value parser.
Add build_accept / build_accept_encoding / negotiated_call, a q-value
parser, and gzip/deflate (incl. raw deflate) decoding. Brotli is excluded
(not stdlib). Wired through facade, executor (AC_decode_body /
AC_parse_quality_values), MCP, and the Script Builder with a headless test
batch and EN/Zh docs.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 46 complexity · 0 duplication

Metric Results
Complexity 46
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 6d12701 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/http-content-batch branch June 21, 2026 18:51
@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