Skip to content

Query params set to default during kick dependency injection #16

@shoang22

Description

@shoang22

Hello,

I have a dependency that uses a query from the client:

def select_model(request: Request = TaskiqDepends(), model: str = Query()):
    return model


@broker.task
async def foo(
    model: str = TaskiqDepends(select_model)
) -> str:
    pdb.set_trace()
    return model


@router.post("/bar")
async def bar():
    print("SENDING")
    task = await foo.kiq()
    print("SENT")
    result = await task.wait_result()
    print("RESULT GOT")
    return {"hello": result.return_value}

I also have the following test:

@pytest.mark.asyncio
async def test_bar(client: AsyncClient) -> None:
    response = await client.post("/api/v1/translate/bar", params={"model": "gpt5000"})
    assert response.status_code == 200 

I set a breakpoint in foo, which shows that the value for model has changed:

(Pdb) model
Query(PydanticUndefined)
(Pdb) 

is this intended behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions