froth-webdriverio-framework 3.0.129 → 3.0.131

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.
@@ -17,13 +17,14 @@ async function callapi(methodtype, api_url, queryParams, payloaddetails, body_ty
17
17
  let headers = await formheaders(authentication, headersdetails, body_type);
18
18
  let body = null;
19
19
  console.log("Body Type:", body_type);
20
- console.log("method:",method);
21
- console.log("headers:",headers);
20
+ console.log("method:", method);
21
+ console.log("headers:", headers);
22
+
22
23
  if (body_type === "raw" && payloaddetails && Object.keys(payloaddetails).length > 0) {
23
24
  console.log("Payload (JSON):", JSON.stringify(payloaddetails));
24
25
  body = JSON.stringify(payloaddetails);
25
26
  console.log("Payload (raw):", body);
26
- } else if (body_type === "formdata" && payloaddetails) {
27
+ } else if (body_type === "form-data" && payloaddetails) {
27
28
  body = await jsonToFormData(payloaddetails);
28
29
  console.log("Payload (FormData):", body);
29
30
  for (let [key, value] of body.entries()) {
@@ -35,24 +36,24 @@ async function callapi(methodtype, api_url, queryParams, payloaddetails, body_ty
35
36
 
36
37
  // console.log("options:", JSON.stringify(options, null, 2));
37
38
  // Send the request
38
- if (method === 'GET' && body) {
39
- console.warn("Warning: GET request with a body is non-standard and may not work with all APIs.");
40
- response = await axios({
41
- method: 'GET',
42
- url: api_url,
43
- headers: headers,
44
- data: body // Axios allows body with GET in some cases
45
- });
46
- } else {
47
- // ✅ Use Fetch for other request types
48
- response = await fetch(api_url, {
49
- method,
50
- headers,
51
- body: method !== 'GET' ? body : null, // Fetch does NOT allow body in GET
52
- });
53
- }
54
-
55
- console.log("Response Data:", response);
39
+ // if (method === 'GET' && body) {
40
+ console.warn("Warning: GET request with a body is non-standard and may not work with all APIs.");
41
+ response = await axios({
42
+ method: method,
43
+ url: api_url,
44
+ headers: headers,
45
+ data: body === null ? undefined : body // Axios allows body with GET in some cases
46
+ });
47
+ // } else {
48
+ // // ✅ Use Fetch for other request types
49
+ // response = await fetch(api_url, {
50
+ // method,
51
+ // headers,
52
+ // body: method !== 'GET' ? body : null, // Fetch does NOT allow body in GET
53
+ // });
54
+ // }
55
+
56
+ console.log("Response Data:", response.data);
56
57
 
57
58
  } catch (error) {
58
59
  console.error('Error during API call in call api menthod:', error);
@@ -88,7 +89,7 @@ async function formheaders(authentication, headers, body_type) {
88
89
  if (!headers || typeof headers !== "object") {
89
90
  headers = {};
90
91
  }
91
- if(body_type === "raw"){
92
+ if (body_type === "raw") {
92
93
  headers['Content-Type'] = 'application/json';
93
94
  }
94
95
  // Add authentication headers based on the type
@@ -60,5 +60,5 @@ function main() {
60
60
 
61
61
  console.log('JWT signed token:', generateJWTToken(payload));
62
62
  }
63
- //main()
63
+ main()
64
64
  module.exports = { generateJWTToken}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.129",
3
+ "version": "3.0.131",
4
4
 
5
5
  "readme": "WebdriverIO Integration",
6
6
  "description": "WebdriverIO and BrowserStack App Automate",