Skip to content

Handle non-JSON private HTTP errors#2615

Merged
subzeroid merged 1 commit into
masterfrom
fix/private-http-jsondecode-error-708
Jun 11, 2026
Merged

Handle non-JSON private HTTP errors#2615
subzeroid merged 1 commit into
masterfrom
fix/private-http-jsondecode-error-708

Conversation

@subzeroid

Copy link
Copy Markdown
Owner

Refs #708

Private HTTP error handling now ignores JSON parse failures while trying to enrich last_json from a failed response body. This preserves status-specific mapping such as 404 -> ClientNotFoundError instead of leaking a JSON decode exception for HTML/non-JSON error pages.

The regression is covered both in the hardening suite and in PrivateGraphQLRequestRegressionTestCase, which is included in the GitHub Actions compatibility test subset.

Verification:

  • .venv/bin/python -m pytest -q tests/regression/test_public.py::PrivateGraphQLRequestRegressionTestCase::test_send_private_request_ignores_non_json_body_on_http_error tests/regression/test_hardening.py::HardeningRegressionTestCase::test_send_private_request_ignores_non_json_body_on_http_error
  • .venv/bin/python -m pytest -q tests/regression/test_public.py::PublicRegressionTestCase tests/regression/test_public.py::PrivateGraphQLRequestRegressionTestCase tests/regression/test_hardening.py tests/regression/test_request_logging.py
  • .venv/bin/python -m pytest -q tests/regression
  • .venv/bin/python -m ruff check .
  • .venv/bin/python -m ruff format --check .
  • .venv/bin/python -m bandit -c pyproject.toml -r instagrapi
  • .venv/bin/python -m build

@subzeroid subzeroid merged commit 7de799d into master Jun 11, 2026
11 checks passed
@subzeroid subzeroid deleted the fix/private-http-jsondecode-error-708 branch June 11, 2026 03:43
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