mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 07:21:23 +08:00
refactor: replace with open file handler, avoid reading files into memory
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
|
## 2.4.2 (2019-12-13)
|
||||||
|
|
||||||
|
**Changed**
|
||||||
|
|
||||||
|
- refactor: replace with open file handler, avoid reading files into memory
|
||||||
|
|
||||||
## 2.4.1 (2019-12-12)
|
## 2.4.1 (2019-12-12)
|
||||||
|
|
||||||
**Added**
|
**Added**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = "2.4.1"
|
__version__ = "2.4.2"
|
||||||
__description__ = "One-stop solution for HTTP(S) testing."
|
__description__ = "One-stop solution for HTTP(S) testing."
|
||||||
|
|
||||||
__all__ = ["__version__", "__description__"]
|
__all__ = ["__version__", "__description__"]
|
||||||
|
|||||||
@@ -128,9 +128,10 @@ def multipart_encoder(**kwargs):
|
|||||||
if is_exists_file:
|
if is_exists_file:
|
||||||
# value is file path to upload
|
# value is file path to upload
|
||||||
filename = os.path.basename(_file_path)
|
filename = os.path.basename(_file_path)
|
||||||
with open(_file_path, 'rb') as f:
|
mime_type = get_filetype(_file_path)
|
||||||
mime_type = get_filetype(_file_path)
|
# TODO: fix ResourceWarning for unclosed file
|
||||||
fields_dict[key] = (filename, f.read(), mime_type)
|
file_handler = open(_file_path, 'rb')
|
||||||
|
fields_dict[key] = (filename, file_handler, mime_type)
|
||||||
else:
|
else:
|
||||||
fields_dict[key] = value
|
fields_dict[key] = value
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "httprunner"
|
name = "httprunner"
|
||||||
version = "2.4.1"
|
version = "2.4.2"
|
||||||
description = "One-stop solution for HTTP(S) testing."
|
description = "One-stop solution for HTTP(S) testing."
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
Reference in New Issue
Block a user