1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Regulate top-level arrays (#1292)

* Redesign the starting path

* Do not cast `:=[1,2,3]` to a top-level array
This commit is contained in:
Batuhan Taskaya
2022-02-09 02:18:40 +03:00
committed by GitHub
parent cafa11665b
commit 225dccb218
6 changed files with 177 additions and 28 deletions

View File

@@ -13,7 +13,8 @@ import urllib3
from . import __version__
from .adapters import HTTPieHTTPAdapter
from .context import Environment
from .cli.dicts import HTTPHeadersDict
from .cli.constants import EMPTY_STRING
from .cli.dicts import HTTPHeadersDict, NestedJSONArray
from .encoding import UTF8
from .models import RequestsMessage
from .plugins.registry import plugin_manager
@@ -280,7 +281,8 @@ def json_dict_to_request_body(data: Dict[str, Any]) -> str:
# item in the object, with an en empty key.
if len(data) == 1:
[(key, value)] = data.items()
if key == '' and isinstance(value, list):
if isinstance(value, NestedJSONArray):
assert key == EMPTY_STRING
data = value
if data: