Repository navigation
fix(http): align default middleware order - #884
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e625fa94-4ae9-464b-8e28-fddf64a8999d
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Disabling WinHTTP redirects exposes incorrect relative-Location resolution for .NET Framework callers; targets must resolve against the full original request URI, with query-only and path-relative regression tests added.
1 open issue
What changed in this PR
Aligns Kiota’s default HTTP middleware order with the SDK design, keeping redirect, retry, inspection, and authorization behavior consistent.
Changes:
- Reorders default handlers and both handler type lists so redirect wraps retry and inspection runs nearest the transport.
- Restricts claims-challenge authentication to the original origin, disables WinHTTP automatic redirects, and resets retry headers between redirect hops.
- Documents the pipeline and adds factory tests for ordering, redirect behavior, and authorization boundaries.
| File | Description |
|---|---|
| tests/http/httpClient/KiotaClientFactoryTests.cs | Adds pipeline ordering, redirect, retry, and claims-challenge tests. |
| src/http/httpClient/README.md | Documents middleware order and authorization behavior. |
| src/http/httpClient/Middleware/RetryHandler.cs | Makes the retry header constant available internally. |
| src/http/httpClient/Middleware/RedirectHandler.cs | Clears the retry attempt header for each redirect hop. |
| src/http/httpClient/Middleware/Options/RedirectHandlerOption.cs | Extracts a shared same-origin comparison. |
| src/http/httpClient/Middleware/AuthorizationHandler.cs | Prevents cross-origin claims-challenge authentication. |
| src/http/httpClient/KiotaClientFactory.cs | Aligns handler ordering and disables WinHTTP automatic redirects. |
Review effort: Balanced
Contributor
Code coverage overviewLanguages: C# C# / code-coverage/dotnet
View coverage of the 3 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e625fa94-4ae9-464b-8e28-fddf64a8999d
Vincent Biret (baywet)
enabled auto-merge
November 24, 2026 15:39
Peter Ombwa (peombwa)
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Validation
net472target): 17 passed.dotnet format --verify-no-changespassed for the changed files in both HTTP projects.