Open geohuz opened 1 year ago
A solution to this chaining problem is still in the works; will update here once it's ready.
Quick update: Started an experimental branch goja, to try to embed a JS processor to enable chaining requests.
Also delegating to a scripting lang, is in line with design philosophy of "delegate to mature tools". By the way, this is pure JS - so we won't allow importing arbitrary npm modules.
Why JS:
For simple use case mentioned above in the thread, one barely has to understand JS to process some JSON and store a variable
Some example files with both Requester + Processor (JS) blocks:
Trivial example:
url = "https://google.com"
---
GET
https://${url}
Advanced:
# stage 1
POST
${LOCAL_COORD}/api/login/
{
"username": "admin",
"password": "Password@123"
}
---
// filtering, store in var; keyword "let" optional
let TOKEN = result["Token"]
---
# stage 2
GET
${LOCAL_COORD}/listorgstyle
Authorization: 'Token ${TOKEN}’'
{}
Any early thoughts/comments/suggestions welcome.
PS: Implementation still in progress
For application using JWT token this is the typical use case, like this in my current curl script:
The first line gets the token from the response and then use the token to GET the result from the second line request.