question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

zap-api-nodejs methods should allow for passing argument Objects

See original GitHub issue

Is 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:open
  • Created 10 months ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
thc202commented, Dec 3, 2022

how can they be integrated to Java code

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).

1reaction
trevor-vaughancommented, Dec 3, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found