nansen-cli 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api.js +2 -8
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -385,13 +385,7 @@ function parseRetryAfter(headerValue) {
|
|
|
385
385
|
|
|
386
386
|
export class NansenAPI {
|
|
387
387
|
constructor(apiKey = config.apiKey, baseUrl = config.baseUrl, options = {}) {
|
|
388
|
-
|
|
389
|
-
throw new NansenError(
|
|
390
|
-
'API key required. Run `nansen login` or set NANSEN_API_KEY environment variable.',
|
|
391
|
-
ErrorCode.UNAUTHORIZED
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
this.apiKey = apiKey;
|
|
388
|
+
this.apiKey = apiKey || null;
|
|
395
389
|
this.baseUrl = baseUrl;
|
|
396
390
|
this.retryOptions = { ...DEFAULT_RETRY_OPTIONS, ...options.retry };
|
|
397
391
|
this.cacheOptions = {
|
|
@@ -434,7 +428,7 @@ export class NansenAPI {
|
|
|
434
428
|
method: 'POST',
|
|
435
429
|
headers: {
|
|
436
430
|
'Content-Type': 'application/json',
|
|
437
|
-
'apikey': this.apiKey,
|
|
431
|
+
...(this.apiKey ? { 'apikey': this.apiKey } : {}),
|
|
438
432
|
...options.headers
|
|
439
433
|
},
|
|
440
434
|
body: JSON.stringify(NansenAPI.cleanBody(body))
|