You've already forked httpie-cli
mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 22:42:05 +02:00
Formalize @ suffix for all operators (#1225)
* Formalize @ suffix for all operators * Separate the section * Address suggestions
This commit is contained in:
@@ -15,6 +15,7 @@ SEPARATOR_HEADER = ':'
|
||||
SEPARATOR_HEADER_EMPTY = ';'
|
||||
SEPARATOR_CREDENTIALS = ':'
|
||||
SEPARATOR_PROXY = ':'
|
||||
SEPARATOR_HEADER_EMBED = ':@'
|
||||
SEPARATOR_DATA_STRING = '='
|
||||
SEPARATOR_DATA_RAW_JSON = ':='
|
||||
SEPARATOR_FILE_UPLOAD = '@'
|
||||
@@ -41,6 +42,7 @@ SEPARATORS_GROUP_MULTIPART = frozenset({
|
||||
|
||||
# Separators for items whose value is a filename to be embedded
|
||||
SEPARATOR_GROUP_DATA_EMBED_ITEMS = frozenset({
|
||||
SEPARATOR_HEADER_EMBED,
|
||||
SEPARATOR_QUERY_EMBED_FILE,
|
||||
SEPARATOR_DATA_EMBED_FILE_CONTENTS,
|
||||
SEPARATOR_DATA_EMBED_RAW_JSON_FILE,
|
||||
@@ -56,6 +58,7 @@ SEPARATOR_GROUP_NESTED_JSON_ITEMS = frozenset([
|
||||
SEPARATOR_GROUP_ALL_ITEMS = frozenset({
|
||||
SEPARATOR_HEADER,
|
||||
SEPARATOR_HEADER_EMPTY,
|
||||
SEPARATOR_HEADER_EMBED,
|
||||
SEPARATOR_QUERY_PARAM,
|
||||
SEPARATOR_QUERY_EMBED_FILE,
|
||||
SEPARATOR_DATA_STRING,
|
||||
|
@@ -8,7 +8,8 @@ from .constants import (
|
||||
SEPARATOR_DATA_EMBED_RAW_JSON_FILE, SEPARATOR_GROUP_NESTED_JSON_ITEMS,
|
||||
SEPARATOR_DATA_RAW_JSON, SEPARATOR_DATA_STRING, SEPARATOR_FILE_UPLOAD,
|
||||
SEPARATOR_FILE_UPLOAD_TYPE, SEPARATOR_HEADER, SEPARATOR_HEADER_EMPTY,
|
||||
SEPARATOR_QUERY_PARAM, SEPARATOR_QUERY_EMBED_FILE, RequestType
|
||||
SEPARATOR_HEADER_EMBED, SEPARATOR_QUERY_PARAM,
|
||||
SEPARATOR_QUERY_EMBED_FILE, RequestType
|
||||
)
|
||||
from .dicts import (
|
||||
BaseMultiDict, MultipartRequestDataDict, RequestDataDict,
|
||||
@@ -48,6 +49,10 @@ class RequestItems:
|
||||
process_empty_header_arg,
|
||||
instance.headers,
|
||||
),
|
||||
SEPARATOR_HEADER_EMBED: (
|
||||
process_embed_header_arg,
|
||||
instance.headers,
|
||||
),
|
||||
SEPARATOR_QUERY_PARAM: (
|
||||
process_query_param_arg,
|
||||
instance.params,
|
||||
@@ -119,6 +124,10 @@ def process_header_arg(arg: KeyValueArg) -> Optional[str]:
|
||||
return arg.value or None
|
||||
|
||||
|
||||
def process_embed_header_arg(arg: KeyValueArg) -> str:
|
||||
return load_text_file(arg).rstrip('\n')
|
||||
|
||||
|
||||
def process_empty_header_arg(arg: KeyValueArg) -> str:
|
||||
if not arg.value:
|
||||
return arg.value
|
||||
|
Reference in New Issue
Block a user