usebruno / bruno

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

Pre-request script cannot make https connection with localhost API #3493

Open tgourley opened 6 days ago

tgourley commented 6 days ago

I have checked the following:

Describe the bug

I am doing local .NET 8 API development and trying to use Bruno to make API calls. There is an authorization endpoint that returns a bearer token. I would like to make a call to this endpoint in the pre-request script, save the bearer token to an environment variable, and then use that for the primary API request.

When trying to make the call using axios, I am getting the a unable to verify the first certificate error.

I have read through many of the past issues as well as StackOverflow and haven't found a fix.

One suggestion was to install https module and use it to override the axios httpAgent. I can confirm that npm successfully installed https to the node_modules folder. But when trying to register the module, I get the error Error invoking remote method 'send-http-request': Error: Error: Cannot find module https

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

anusree-bruno commented 3 days ago

Hi @tgourley!

To use https module can you check if you have these things

  1. You are in the developer mode. image

  2. You have whitelisted the https module inside bruno.json image

scripts": {
    "moduleWhitelist": ["https"],
    "filesystemAccess": {
      "allow": true
    }
  }