Describe the bug
The FletX HTTP Client module contains several critical bugs that prevent proper HTTP request execution, particularly affecting authentication services and API communication. The issues spanned parameter naming conflicts, exception handling incompatibilities, and method signature problems.
To Reproduce
Create a simple FletXService class that is going to make requests. for example:
class SignInService(FletXService):
def __init__(self):
# Get the backend URL from environment variable
backend_url = os.getenv("BACKEND_URL", "http://localhost:3000")
super().__init__(http_client=HTTPClient(base_url=backend_url))
async def post(self, email: str, password: str):
"""
Sign in user with email and password
Args:
email: User's email address
password: User's password
Returns:
Response from the backend API
"""
try:
payload = {
"email": email,
"password": password
}
response = await self.http_client.post(
endpoint="/api/auth/login",
json_data=payload
)
return response
except Exception as e:
print(f"SignIn Error: {e}")
raise
Expected behavior
This is suppose to make a simple request to our API, however i kept encountering this error:
flet_app | /usr/local/lib/python3.12/site-packages/aiohttp/connector.py:963: DeprecationWarning: enable_cleanup_closed ignored because python/cpython#118960 is fixed in Python version sys.version_info(major=3, minor=12, micro=12, releaselevel='final', serial=0)
flet_app | super().init(
flet_app | SignIn Error: ClientSession.request() missing 1 required positional argument: 'method'
flet_app | 2025-11-27 06:50:49,804 - FletX.Reactive - DEBUG - Value changed: → An error occurred: ClientSession.request() missing 1 required positional argument: 'method'
the http client was calling the post method but it kept on throwing this problem.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I have managed to fix the fix issue. There was a typo in fletx.core.http in the async with self._session.request.
"metho = method" it is suppose to be "method = method". Moreover in wait self._apply_middlewares_before, there is "json = json_data" it is suppose to be "json_data = json_data. Then finally in fletx.utils.exceptions, i have modified the exceptions to accept custom parameters than just the message. this is how i modified them: ####
NETWORK ERROR CLASS
class NetworkError(FletXError):
"""
Exception raised when there's a network error with http operations.
"""
def init(self, message=None, original_exception=None):
self.message = message
self.original_exception = original_exception
super().init(self.message or "Network error occurred")
RATE LIMIT ERROR CLASS
class RateLimitError(FletXError):
"""
Exception raised when there's a rate limit error with http operations.
"""
def init(self, message=None, status_code=None, raw_response=None, headers=None):
self.message = message
self.status_code = status_code
self.raw_response = raw_response
self.headers = headers
super().init(self.message or "Rate limit exceeded")
API ERROR CLASS
class APIError(FletXError):
"""
Exception raised when there's an API error with http operations.
"""
def init(self, message=None, status_code=None, response_data=None):
self.message = message
self.status_code = status_code
self.response_data = response_data
super().init(self.message or "API error occurred")
i have already forked this repository. With your permission, i would like to contribute my solution. Thank you
Describe the bug
The FletX HTTP Client module contains several critical bugs that prevent proper HTTP request execution, particularly affecting authentication services and API communication. The issues spanned parameter naming conflicts, exception handling incompatibilities, and method signature problems.
To Reproduce
Create a simple FletXService class that is going to make requests. for example:
class SignInService(FletXService):
Expected behavior
This is suppose to make a simple request to our API, however i kept encountering this error:
flet_app | /usr/local/lib/python3.12/site-packages/aiohttp/connector.py:963: DeprecationWarning: enable_cleanup_closed ignored because python/cpython#118960 is fixed in Python version sys.version_info(major=3, minor=12, micro=12, releaselevel='final', serial=0)
flet_app | super().init(
flet_app | SignIn Error: ClientSession.request() missing 1 required positional argument: 'method'
flet_app | 2025-11-27 06:50:49,804 - FletX.Reactive - DEBUG - Value changed: → An error occurred: ClientSession.request() missing 1 required positional argument: 'method'
the http client was calling the post method but it kept on throwing this problem.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I have managed to fix the fix issue. There was a typo in fletx.core.http in the async with self._session.request.
"metho = method" it is suppose to be "method = method". Moreover in wait self._apply_middlewares_before, there is "json = json_data" it is suppose to be "json_data = json_data. Then finally in fletx.utils.exceptions, i have modified the exceptions to accept custom parameters than just the message. this is how i modified them: ####
NETWORK ERROR CLASS
class NetworkError(FletXError):
"""
Exception raised when there's a network error with http operations.
"""
def init(self, message=None, original_exception=None):
self.message = message
self.original_exception = original_exception
super().init(self.message or "Network error occurred")
RATE LIMIT ERROR CLASS
class RateLimitError(FletXError):
"""
Exception raised when there's a rate limit error with http operations.
"""
def init(self, message=None, status_code=None, raw_response=None, headers=None):
self.message = message
self.status_code = status_code
self.raw_response = raw_response
self.headers = headers
super().init(self.message or "Rate limit exceeded")
API ERROR CLASS
class APIError(FletXError):
"""
Exception raised when there's an API error with http operations.
"""
def init(self, message=None, status_code=None, response_data=None):
self.message = message
self.status_code = status_code
self.response_data = response_data
super().init(self.message or "API error occurred")
i have already forked this repository. With your permission, i would like to contribute my solution. Thank you