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