Skip to content

fix: honor Kiota request extensions in Graph transport - #1129

Open
RKS (rksharma-owg) wants to merge 1 commit into
microsoftgraph:mainfrom
rksharma-owg:codex/graph-kiota-request-options
Open

RKS (rksharma-owg) wants to merge 1 commit into
microsoftgraph:mainfrom
rksharma-owg:codex/graph-kiota-request-options

Conversation

@rksharma-owg

Copy link
Copy Markdown

Overview

Restore Graph middleware execution for requests built by microsoft-kiota-http 1.13.0. Graph-core 1.5.1 only enters its middleware pipeline when an HTTPX request has the legacy .options attribute. Kiota commit d9180bb moved per-request options to request.extensions["kiota_request_options"], so the Graph transport bypasses redirect, URL replacement, retry, and telemetry middleware. For an empty 302 response from DriveItem /content, this makes the binary request return None instead of following the download URL.

Accept the extension-based options while retaining support for the legacy attribute used by earlier Kiota releases. Graph request context now receives the extension options when present. No public API or generated SDK changes are needed.

Fixes #1128. Related: microsoft/kiota-python#745 and microsoft/kiota-python#744.

Notes

A credential-free HTTPX transport reproduction returned None after one 302 with Kiota HTTP 1.13.0, but followed the redirect and returned bytes with 1.12.3. The new integration test failed on the unmodified Graph-core transport and passes with this change. It covers two binary content types, legacy option compatibility, extension precedence, and requests without options.

The full-tree isort --check-only src reports an unchanged import-order issue in batch_request_item.py; the repository's actual CI command, isort src, succeeds and only reorders that existing file in an isolated checkout. No unrelated formatting is included here.

Testing Instructions

  • Run pytest after installing requirements-dev.txt: 78 passed locally with its pinned Kiota HTTP 1.11.6.
  • With Kiota HTTP 1.13.0 and HTTPX 0.27.0, run pytest: 78 passed locally on Python 3.12.
  • Run yapf -dr src, mypy src, and pylint src --disable=W --rcfile=.pylintrc: passed locally. Changed-file isort --check-only and sdist/wheel build also passed.
  • Fork preflight checked out contribution SHA b8d5927c651c5e049a132021e72f8d01c83d5021 against upstream base ec79992519f708a014676584d5626ea8d733fe2c: Python 3.10–3.14 × Kiota HTTP 1.11.6/1.13.0 (10 jobs, 78 tests each), format, changed-file import order, mypy, pylint, and CodeQL passed: https://github.com/rksharma-owg/msgraph-sdk-python-core/actions/runs/35680942215.

@rksharma-owg
RKS (rksharma-owg) requested a review from a team as a code owner September 22, 2026 02:53
@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.

AsyncGraphTransport silently skips the entire middleware pipeline (URL-replace, retry, redirect) with microsoft-kiota-http>=1.13.0

1 participant