Repository navigation
fix(http): pass mypy --strict in middleware options and fix three option bugs - #809
Merged
Vincent Biret (baywet) merged 2 commits intoOct 16, 2026
Conversation
…ion bugs Add the missing return types in kiota_http.middleware.options. Part of microsoft#722. UserAgentHandlerOption.is_enabled set self._value, so setting it to False did nothing. It now sets self._enabled. UrlReplaceHandlerOption and ParametersNameDecodingHandlerOption used a dict and a list as default arguments. Python builds those once, so every option made with the default shared them, and a change to one showed up in all of them. The defaults are None now, and each option gets its own dict or list.
7 of 11 tasks
|
Vincent Biret (baywet)
approved these changes
Oct 16, 2026
Vincent Biret (baywet)
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution!
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.



Overview
Seventh item in #722.
kiota_http.middleware.optionsnow passesmypy --strict, so errors inkiota_httpgo from 115 to 88 (mypy 2.4.0). The typedget_key()methods also clear three untyped calls in the adapter, the client factory and the retry handler.Related Issue
Part of #722.
Demo
Not needed for this change.
Notes
While adding the types I found three bugs, and their fixes are the only runtime changes.
UserAgentHandlerOption.is_enabled = Falsedid nothing, because the setter wroteself._value(L31). It now setsself._enabled.UrlReplaceHandlerOption(L10) andParametersNameDecodingHandlerOption(L11) used a dict and a list as default arguments. Python builds those once, so every option made with the default shared them, and a change to one showed up in all. The defaults areNonenow, and each option gets its own dict or list with the same default values.Testing Instructions
mypy --strict kiota_httpinpackages/http/httpxshows nothing undermiddleware/options/, also with--python-version 3.10, and 88 errors overall instead of 115.mypy kiota_http,yapf -dr kiota_http,pylintandpytestpass.