Comments (5)
@DivyMohan14 Thanks for taking time and making async scripting work !
from bruno.
Hi @DivyMohan14 !
Glad that you like Bruno!
Also, nice to see that you are checking out the external libraries feature.
It's one of the features that makes us unique to other similar tools out there.
The reason for using sandbox
is from a security standpoint, the goal being yours script should not access filesystem unless you provide explicit access. This is to protect from any malicious 3rd party libs that might try to access stuff using fs
module
The long term plan is to give more flexibility for the user to turn off the sandbox
, via a ui toggle in the app OR allow to override it using a property in bruno.json
at the collection level
For the short term, I feel we can give access to some core nodejs modules inside the sandbox by default.
I am thinking of opening up access to stream
, path
, url
, util
modules
Can you take this up @DivyMohan14 and raise a PR ?
You can import the 4 core node modules here and inject them into the sandbox here
There is a problem that you might run into. The pre-request script works fine with synchronous code, but I don't think it yet handles asynchronous code like fetch
. Please let me know how it goes?
from bruno.
I spent some time on this today.
Added some node core modules to the sandbox. I also plan to expose node-fetch
and axios
out of the box as this is a very common use case for people to hit a http endpoint pre/post request.
Here is the PR that is tracking this work: https://github.com/usebruno/bruno/pull/139/files
Currently struggling with making async await work in NodeVM
Raised a github issue here: patriksimek/vm2#513
from bruno.
Yeah was working on this as well, same thing NodeVM
is not waiting for the async function to finish implementation as you already pointed out.
So I thought if this is not fully supported will shift to some sync request libraries like sync-request
This internally uses child_process to spawn a new worker thread and then process the request. Will be trying to set this up and see if I can make this work.
from bruno.
@DivyMohan14 Would you mind posting your resulting access-token pre-request script here for posterity?
from bruno.
Related Issues (20)
- [BUG] Not getting proper focus on Menu item when move Cursor (to left, to right)
- [BUG] Can't navigate Main Menu by pressing left or right arrow HOT 1
- Error if the REQUEST name contains more than one '/' HOT 2
- http POST application/octet-stream HOT 1
- Serve application updates trough the application with update options (Autodownload, auto update/install) HOT 1
- Automatic refresh of a OAuth2+PKCE token
- Bruno converts decimal numbers in JSON body to strings HOT 1
- Request with pathParam returning 400 code HOT 7
- Crashes when closing the window
- [Feature Request] Change response body before showing it: res.setBody()
- AxiosError: maxContentLength size of -1 exceeded
- Golden Edition License Key: Licence key already in use
- Error attempying to Generate Code HOT 8
- OAuth2: The scope in case of `Password Credentials` grant type
- Crashing when switching from GraphQL variables back to request body HOT 2
- OAuth 2.0 - Client credentials always returning "'undefined' is not valid JSON" HOT 1
- crashing when generating code from request HOT 1
- Nested vars support? HOT 2
- Initialisation Issue HOT 2
- import collection from postman lose name HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bruno.