Skip to content

feat: forward request options to Kiota's default handlers - #1089

Open
Egor Sidorenko (esidorenko-sl) wants to merge 2 commits into
microsoftgraph:mainfrom
esidorenko-sl:feature/forward-request-options-to-kiota-handlers
Open

feat: forward request options to Kiota's default handlers#1089
Egor Sidorenko (esidorenko-sl) wants to merge 2 commits into
microsoftgraph:mainfrom
esidorenko-sl:feature/forward-request-options-to-kiota-handlers

Conversation

@esidorenko-sl

@esidorenko-sl Egor Sidorenko (esidorenko-sl) commented Aug 26, 2026

Copy link
Copy Markdown

Related to #1004

Changes proposed in this pull request

  • Add a CreateDefaultHandlers(GraphClientOptions, IRequestOption[]) overload that passes the options through to KiotaClientFactory.CreateDefaultHandlers.
  • Keep the existing CreateDefaultHandlers(GraphClientOptions = null) unchanged, so this is source and binary compatible. It now delegates to the new overload with no options.
  • Add a test covering a custom RetryHandlerOption reaching the RetryHandler that comes back.

Kiota's CreateDefaultHandlers already takes an IRequestOption[] for configuring the handlers it builds. GraphClientFactory calls it with no arguments, so those options are dropped before a caller can reach them.

Other links

#1004 was closed as by design, and I understand the reasoning: swapping a handler out is a supported approach. I am opening this anyway for two reasons. The overload is additive, so it costs nothing to keep and breaks nothing. And the request in #1004 was to add an optional parameter to the existing method, which would have been a binary breaking change, so it is worth separating the idea from the way it was originally proposed.

If you would still rather not widen the surface here, close it and I will not push back.

Microsoft Reviewers: Open in CodeFlow

…s to Kiota handlers

GraphClientFactory.CreateDefaultHandlers called KiotaClientFactory.CreateDefaultHandlers()
with no arguments, even though Kiota exposes an overload that takes an array of
IRequestOption to configure the default handlers (for example a RetryHandlerOption).
Because of that, the only way to change retry behaviour was to find the RetryHandler
in the returned list, remove it, and add a replacement.

This adds a second CreateDefaultHandlers overload that takes an IRequestOption[] and
forwards it into KiotaClientFactory.CreateDefaultHandlers, while keeping the existing
telemetry handler behaviour. The old overload now just calls the new one with no
options, so it keeps working exactly as before and no existing public signature changes.

Issue microsoftgraph#1004 asked for this and was closed as by design before the Kiota migration
happened, when this option did not exist one layer down yet.
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