From c39821415a2460ad65bb53e28de1753aeeb45519 Mon Sep 17 00:00:00 2001 From: Kim Carter Date: Tue, 30 Oct 2018 13:56:13 +1300 Subject: [PATCH] Removed mandatory apiKey --- src/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 53b9e57..342491d 100644 --- a/src/index.js +++ b/src/index.js @@ -56,15 +56,14 @@ function ClientApi(options) { _.defaults(options, { proxy: 'http://127.0.0.1:8080' }); - - if (!options.apiKey) throw new Error('An apiKey must be provided for the Zap API.'); const requestOptions = { method: 'GET', json: true, - apiKey: options.apiKey, proxy: options.proxy }; + + if (options.apiKey) requestOptions.headers = { 'X-ZAP-API-Key': options.apiKey }; this.req = request.defaults(requestOptions); this.reqPromise = requestPromise.defaults(requestOptions);