Skip to content

Incoming query params without value are modified #67

Description

@wabiloo

Describe the bug

I am working with a remote service that expects (among other things) a query parameter without value, eg "&bla".
However when going through the reverse proxy, the call made adds an = sign, which renders the call invalid for that remote service (over which I have no control)

To Reproduce

  1. create a file main.py
from fastapi_proxy_lib.core.http import ReverseHttpProxy
from httpx import AsyncClient
from starlette.requests import Request
import logging 

logging.basicConfig(level=logging.DEBUG)

proxy = ReverseHttpProxy(AsyncClient(), base_url="https://www.httpbin.org/")

app = FastAPI()

@app.get("/get")
async def get(request: Request):
    return await proxy.proxy(request=request, path="get")
  1. Run with uvicorn main:app --host 127.0.0.1 --port 8000
  2. Call http://127.0.01:8000/get?bla
  3. Notice in the logs that the call is made to https://www.httpbin.org/get?bla=, instead of https://www.httpbin.org/get?bla

Expected behavior

Query parameters should remain unchanged, even if they have no value

Configuration

  • Python version: 13
  • OS version: MacOS 15.5
  • deps version:
    annotated-types==0.7.0
    anyio==4.6.2.post1
    Brotli==1.1.0
    certifi==2024.8.30
    charset-normalizer==3.4.0
    click==8.1.7
    dnspython==2.7.0
    email_validator==2.2.0
    fastapi==0.111.1
    fastapi-cli==0.0.5
    fastapi-proxy-lib==0.3.0
    h11==0.14.0
    httpcore==1.0.6
    httptools==0.6.4
    httpx==0.27.2
    httpx-ws==0.7.2
    idna==3.10
    Jinja2==3.1.4
    loguru==0.7.2
    markdown-it-py==3.0.0
    MarkupSafe==3.0.2
    mdurl==0.1.2
    pydantic==2.9.2
    pydantic_core==2.23.4
    Pygments==2.18.0
    python-dotenv==1.0.1
    python-multipart==0.0.17
    PyYAML==6.0.2
    requests==2.32.3
    rich==13.9.4
    shellingham==1.5.4
    sniffio==1.3.1
    starlette==0.37.2
    typer==0.13.0
    typing_extensions==4.12.2
    urllib3==2.2.3
    uvicorn==0.29.0
    uvloop==0.21.0
    watchfiles==0.24.0
    websockets==13.1
    wsproto==1.2.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions