Skip to content

Preserve request params and validate upload files in HTTPXAPITarget#1487

Open
biefan wants to merge 3 commits intoAzure:mainfrom
biefan:preserve-httpx-api-target-query-params
Open

Preserve request params and validate upload files in HTTPXAPITarget#1487
biefan wants to merge 3 commits intoAzure:mainfrom
biefan:preserve-httpx-api-target-query-params

Conversation

@biefan
Copy link
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • preserve params for non-GET HTTPXAPITarget requests
  • preserve params for file-upload requests as well as JSON/form requests
  • raise a clear FileNotFoundError when an explicitly provided upload path does not exist
  • add regression coverage for query-parameter handling and explicit missing upload files

Problem

HTTPXAPITarget exposes a params constructor argument, but send_prompt_async() currently drops it outside the GET/HEAD path. That affects both standard API calls and file-upload requests.

The same method also accepts an explicit file_path, and its docstring says a missing file should raise FileNotFoundError. In practice, if that path does not exist, the upload branch is silently skipped and the request falls back to a normal non-upload request.

Examples that currently behave incorrectly:

  • POST /endpoint?alpha=1 with json_data=...
  • POST /upload?alpha=1 with file_path=...
  • an explicit file_path pointing to a missing file

This makes valid API patterns impossible to express and hides configuration mistakes that should fail fast.

Testing

  • .venv/bin/pytest tests/unit/target/test_http_api_target.py -q

@biefan biefan changed the title Preserve query params for HTTPX API requests Preserve request params and validate upload files in HTTPXAPITarget Mar 17, 2026
@hannahwestra25 hannahwestra25 self-assigned this Mar 17, 2026
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.

2 participants