Skip to content

Commit 194276e

Browse files
committed
add doc comments for performance http action
1 parent 17c565a commit 194276e

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

Framework/Built_In_Automation/Sequential_Actions/lorust_performance_action.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import subprocess
44
import platform
55
from pathlib import Path
6-
from typing import Callable, List, Tuple, Any
6+
from typing import List, Tuple
77

88
from Framework.Built_In_Automation.Shared_Resources import BuiltInFunctionSharedResources as sr
99
from Framework.Utilities import CommonUtil, ConfigModule
@@ -104,8 +104,53 @@ def find_row_by(
104104
try: method = find_row_by(action, left="method")[0][2]
105105
except: method = "GET"
106106

107-
try: body = find_row_by(action, mid="body")[0][2]
108-
except: body = "Empty"
107+
try:
108+
body = find_row_by(action, mid="body")[0]
109+
body_type = body[0].strip()
110+
if body_type == "Empty":
111+
# 1. No body
112+
#
113+
# "Empty"
114+
body = "Empty"
115+
else:
116+
# 2. Raw string - mostly used with the "Content-Type" header having the values:
117+
# application/json
118+
# text/plain
119+
# {
120+
# "Raw": "some raw string"
121+
# }
122+
#
123+
# 3. Form data - both strings and files are supported, used with "Content-Type":
124+
# multipart/form-data
125+
# {
126+
# "FormData": [
127+
# ["first_name", { "Str": "Mini" }],
128+
# ["last_name", { "Str": "Tiny" }],
129+
# ["age", { "Str": "10" }],
130+
# ["profile_picture_file", { "FilePath": "/path/to/profile/picture" }]
131+
# ]
132+
# }
133+
#
134+
# 4. Form URL Encoded data, used with "Content-Type":
135+
# application/x-www-form-urlencoded
136+
# {
137+
# "FormUrlEncoded": [
138+
# ["first_name", "Mini"],
139+
# ["last_name", "Tiny"],
140+
# ["age", 10]
141+
# ]
142+
# }
143+
#
144+
# 5. Binary file upload, used with "Content-Type":
145+
# application/octet-stream
146+
# {
147+
# "BinaryOctetFilePath": "/path/to/file"
148+
# }
149+
body = {
150+
body[0]: body[2],
151+
}
152+
except:
153+
body = "Empty"
109154

110155
try: redirect_limit = int(find_row_by(action, left="redirect_limit")[0][2])
111156
except: redirect_limit = None

0 commit comments

Comments
 (0)