Skip to content

Instantly share code, notes, and snippets.

@allaniftrue
Last active August 18, 2022 11:30
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allaniftrue/7ed41f77ffc950ed2f27ce216dd76dd6 to your computer and use it in GitHub Desktop.
Save allaniftrue/7ed41f77ffc950ed2f27ce216dd76dd6 to your computer and use it in GitHub Desktop.
axios configuration to disable certificate verification
import axios from 'axios';
import https from 'https';
axios.create({
baseURL: 'https://localhost:3001',
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
@EmanuelNog
Copy link

const api = axios.create({
baseURL: 'https://localhost:3001',
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});

const data= {
login : 'loginname',
password : 'pass'
}

runProgram();

async function runProgram(){
const response = await api.post('/param',data);
console.log(response);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment