zap-api-nodejs methods should allow for passing argument Objects
See original GitHub issueIs your feature request related to a problem? Please describe.
Presently, the arguments to API calls are positional as shown in the script.load function.
This presents a usability issue since you end up needing to pass null
for optional arguments.
Additionally, the arguments are immediately converted into a params
variable.
Describe the solution you’d like
I would like to be able to pass all options as an Object
which would be used as params
and/or merged with the defaults if there are any.
Describe alternatives you’ve considered
None.
Screenshots
No response
Additional context
I noted that the comments indicated that the code was auto-generated so I wasn’t going to start working on any PRs until I had a grasp of that mechanism if it is still in use.
Would you like to help fix this issue?
- Yes
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
The arguments object - JavaScript - MDN Web Docs - Mozilla
arguments is an Array-like object accessible inside functions that contains the values of the arguments passed to that function.
Read more >Chapter 7. Object arguments: functions working with objects
Just as passing objects to functions as arguments is an efficient way of moving information to where it's needed, so is using objects...
Read more >Passing Information to a Method or a Constructor
Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the arguments used must...
Read more >JavaScript Function Parameters - W3Schools
If a function is called with too many arguments (more than declared), these arguments can be reached using the arguments object. Arguments are...
Read more >Unlimited arguments in a JavaScript function - Stack Overflow
As an alternative, you could have one parameter - "unlimited" container such as array (or object) and then just pass everything as array,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s not much to integrate the generator just needs to output the corresponding text. It worth noting that not all parameters are documented and the actual type is not available (they will always be string right now).
@njmulsqb I’m currently using it to drive the ZAP API automatically from a node.js CLI.
Being able to drive things in Node allows me to easily port it over to a web view at some point if I want to.
If you’re building web apps, you’re probably already doing some level of front end building with Node so adding yet another language (Python) is unnecessary.