Skip to content

[Help] Sending a request in Pre Request Script using axios #2268

Closed Answered by tho-gru-38
tho-gru-38 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

After getting some help from my Colleges I found the following solution:

console.log("Axios-send-request: Pre Request - Start");

const axios = require("axios");

// if you need to ignore invalid SSL certificate
const https = require('https');
const agent = new https.Agent({  
 rejectUnauthorized: false
});

const urls = {
  httpbin: "https://httpbin.org/get",
  jsonWork: "https://jsonplaceholder.org/users",
  jsonError: "https://jsonplaceholder.org/users-xxx",
  };


var headerObject = {};

// do not show the password unencrypted in the console
const username = bru.getEnvVar("AuthorizationBasicUsername");
const password = bru.getEnvVar("AuthorizationBasicPassword");
const encoded = B…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tho-gru-38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant