Description
Description
When a declarative HTTP request supplies both:
- A URL that already contains query parameters
- Additional values through
query_parameters
the parameters already present in the URL are silently removed.
For example, this intended request:
https://api.example.test/items?api-version=2025-01-01&tenant=alpha&page=2
is sent as:
https://api.example.test/items?page=2
This can cause otherwise valid API requests to fail or target the wrong API version or tenant.
What I expected
Parameters supplied through query_parameters should be appended to the URL while preserving parameters already present in the URL.
Steps to reproduce
- Create a
DefaultHttpRequestHandler.
- Use a URL containing one or more query parameters.
- Supply another parameter through
HttpRequestInfo.query_parameters.
- Send the request and inspect the resulting URL.
- Observe that the original URL parameters are missing.
Code Sample
import asyncio
import httpx
from agent_framework_declarative import (
DefaultHttpRequestHandler,
HttpRequestInfo,
)
async def main() -> None:
captured_urls: list[str] = []
def respond(request: httpx.Request) -> httpx.Response:
captured_urls.append(str(request.url))
return httpx.Response(200, text="ok")
async with httpx.AsyncClient(
transport=httpx.MockTransport(respond),
) as client:
handler = DefaultHttpRequestHandler(client=client)
await handler.send(
HttpRequestInfo(
method="GET",
url=(
"https://api.example.test/items"
"?api-version=2025-01-01&tenant=alpha"
),
query_parameters={"page": "2"},
)
)
print(captured_urls[0])
asyncio.run(main())
Actual output:
https://api.example.test/items?page=2
Expected output:
https://api.example.test/items?api-version=2025-01-01&tenant=alpha&page=2
Error Messages / Stack Traces
No exception is raised. The request is sent successfully with an incorrect URL.
Package Versions
agent-framework-declarative: 1.0.1
Python Version
Python 3.12.10
Additional Context
The equivalent .NET declarative HTTP handler preserves the existing query string when additional query parameters are supplied.
Custom HTTP request handlers may be unaffected. The issue reproduces with the default Python handler.
Description
Description
When a declarative HTTP request supplies both:
query_parametersthe parameters already present in the URL are silently removed.
For example, this intended request:
is sent as:
This can cause otherwise valid API requests to fail or target the wrong API version or tenant.
What I expected
Parameters supplied through
query_parametersshould be appended to the URL while preserving parameters already present in the URL.Steps to reproduce
DefaultHttpRequestHandler.HttpRequestInfo.query_parameters.Code Sample
import asyncio import httpx from agent_framework_declarative import ( DefaultHttpRequestHandler, HttpRequestInfo, ) async def main() -> None: captured_urls: list[str] = [] def respond(request: httpx.Request) -> httpx.Response: captured_urls.append(str(request.url)) return httpx.Response(200, text="ok") async with httpx.AsyncClient( transport=httpx.MockTransport(respond), ) as client: handler = DefaultHttpRequestHandler(client=client) await handler.send( HttpRequestInfo( method="GET", url=( "https://api.example.test/items" "?api-version=2025-01-01&tenant=alpha" ), query_parameters={"page": "2"}, ) ) print(captured_urls[0]) asyncio.run(main()) Actual output: https://api.example.test/items?page=2 Expected output: https://api.example.test/items?api-version=2025-01-01&tenant=alpha&page=2Error Messages / Stack Traces
Package Versions
agent-framework-declarative: 1.0.1
Python Version
Python 3.12.10
Additional Context
The equivalent .NET declarative HTTP handler preserves the existing query string when additional query parameters are supplied.
Custom HTTP request handlers may be unaffected. The issue reproduces with the default Python handler.