Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastHttpSession requests typing for the json argument should support lists #2842

Closed
2 tasks done
MarcSalvat opened this issue Aug 8, 2024 · 0 comments · Fixed by #2885
Closed
2 tasks done

FastHttpSession requests typing for the json argument should support lists #2842

MarcSalvat opened this issue Aug 8, 2024 · 0 comments · Fixed by #2885
Labels

Comments

@MarcSalvat
Copy link

Prerequisites

Description

Typing for FastHttpSession was added here but the json argument should also allow for lists, not only dictionaries.

Example:
POST /books/bulk
[
{
"title": "The Hitchhiker's Guide to the Galaxy",
"author": "Douglas Adams",
"isbn": "9780345391803",
"genre": "Science Fiction",
"publication_year": 1979,
"description": "A hilarious and thought-provoking adventure through space and time."
},
{
"title": "Pride and Prejudice",
"author": "Jane Austen",
"isbn": "9780141439518",
"genre": "Classic Literature",
"publication_year": 1813,
"description": "A witty exploration of love, class, and social expectations in Regency England."
}
]

Current implementation will show an error with mypy:

error: Argument "json" to "put" of "FastHttpSession" has incompatible type "list[dict[str, object]]"; expected "dict[Any, Any] | None" [arg-type]

Command line

Locustfile contents

-

Python version

3.12.2

Locust version

2.31.2

Operating system

Ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant