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

Add --multipart and --boundary

This commit is contained in:
Jakub Roztocil
2020-08-19 10:22:42 +02:00
parent a23b0e39e5
commit 1813cf6156
7 changed files with 186 additions and 16 deletions

View File

@@ -16,7 +16,7 @@ from httpie.cli.dicts import RequestHeadersDict
from httpie.plugins.registry import plugin_manager
from httpie.sessions import get_httpie_session
from httpie.ssl import AVAILABLE_SSL_VERSION_ARG_MAPPING, HTTPieHTTPSAdapter
from httpie.uploads import get_multipart_data
from httpie.uploads import get_multipart_data_and_content_type
from httpie.utils import get_expired_cookies, repr_dict
@@ -276,8 +276,13 @@ def make_request_kwargs(
headers.update(args.headers)
headers = finalize_headers(headers)
if args.form and files:
data, headers['Content-Type'] = get_multipart_data(data, files)
if args.form and (files or args.multipart):
data, headers['Content-Type'] = get_multipart_data_and_content_type(
data=data,
files=files,
boundary=args.boundary,
content_type=args.headers.get('Content-Type'),
)
files = None
kwargs = {