|
3 | 3 | import subprocess |
4 | 4 | import platform |
5 | 5 | from pathlib import Path |
6 | | -from typing import Callable, List, Tuple, Any |
| 6 | +from typing import List, Tuple |
7 | 7 |
|
8 | 8 | from Framework.Built_In_Automation.Shared_Resources import BuiltInFunctionSharedResources as sr |
9 | 9 | from Framework.Utilities import CommonUtil, ConfigModule |
@@ -104,8 +104,53 @@ def find_row_by( |
104 | 104 | try: method = find_row_by(action, left="method")[0][2] |
105 | 105 | except: method = "GET" |
106 | 106 |
|
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" |
109 | 154 |
|
110 | 155 | try: redirect_limit = int(find_row_by(action, left="redirect_limit")[0][2]) |
111 | 156 | except: redirect_limit = None |
|
0 commit comments