usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.43k stars 1.16k forks source link

Axios is null in pre-script #2674

Closed garposmack closed 1 month ago

garposmack commented 2 months ago

I have checked the following:

Describe the bug

I have the following script in the pre-script of my collection (and also tried in only 1 request) const axios = require('axios'); console.log(axios); on the console i get null as a result.

I was trying to create a pre-script to fetch a token from an url, and i was not able... and it seems that the reason is because axios is null

I have also tried the same with moment, and got the same result.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

Its-treason commented 2 months ago

Try to log typeof axios it will be a function. Because functions cannot be serialised Bruno logs null.

helloanoop commented 1 month ago

@garposmack Here is a sample axios code

const axios = require("axios");
const response = await axios.get("https://api.github.com/users/usebruno");
console.logresponse.data.avatar_url);

Closing this issue. @garposmack please re-open the issue if you are still struggling to make axios work.