froth-webdriverio-framework 3.0.126 → 3.0.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/froth_common_actions/apicall.js +14 -14
- package/package.json +1 -1
|
@@ -15,6 +15,8 @@ async function callapi(methodtype, api_url, queryParams, payloaddetails, body_ty
|
|
|
15
15
|
let headers = await formheaders(authentication, headersdetails, body_type);
|
|
16
16
|
let body = null;
|
|
17
17
|
console.log("Body Type:", body_type);
|
|
18
|
+
console.log("method:",method);
|
|
19
|
+
console.log("headers:",headers);
|
|
18
20
|
if (body_type === "raw" && payloaddetails && Object.keys(payloaddetails).length > 0) {
|
|
19
21
|
console.log("Payload (JSON):", JSON.stringify(payloaddetails));
|
|
20
22
|
body = JSON.stringify(payloaddetails);
|
|
@@ -31,17 +33,17 @@ async function callapi(methodtype, api_url, queryParams, payloaddetails, body_ty
|
|
|
31
33
|
|
|
32
34
|
// console.log("options:", JSON.stringify(options, null, 2));
|
|
33
35
|
// Send the request
|
|
34
|
-
if (method === 'GET' && body) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} else
|
|
36
|
+
// if (method === 'GET' && body) {
|
|
37
|
+
// console.warn("Using X-HTTP-Method-Override for GET with body.");
|
|
38
|
+
// response = await fetch(api_url, {
|
|
39
|
+
// method: 'POST', // Override to POST
|
|
40
|
+
// headers: {
|
|
41
|
+
// ...headers,
|
|
42
|
+
// 'X-HTTP-Method-Override': 'GET' // Trick the API into treating it as GET
|
|
43
|
+
// },
|
|
44
|
+
// body: body
|
|
45
|
+
// });
|
|
46
|
+
// } else
|
|
45
47
|
response = await fetch(api_url, {method,headers, body});
|
|
46
48
|
|
|
47
49
|
console.log("Response Data:", response);
|
|
@@ -80,9 +82,7 @@ async function formheaders(authentication, headers, body_type) {
|
|
|
80
82
|
if (!headers || typeof headers !== "object") {
|
|
81
83
|
headers = {};
|
|
82
84
|
}
|
|
83
|
-
if
|
|
84
|
-
headers['Content-Type'] = 'multipart/form-data';
|
|
85
|
-
}if(body_type === "raw"){
|
|
85
|
+
if(body_type === "raw"){
|
|
86
86
|
headers['Content-Type'] = 'application/json';
|
|
87
87
|
}
|
|
88
88
|
// Add authentication headers based on the type
|