@wharfkit/antelope
Advanced tools
Comparing version 1.0.11-rc2 to 1.0.11
{ | ||
"name": "@wharfkit/antelope", | ||
"description": "Library for working with Antelope powered blockchains.", | ||
"version": "1.0.11-rc2", | ||
"version": "1.0.11", | ||
"homepage": "https://github.com/wharfkit/antelope", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause-No-Military-License", |
@@ -74,5 +74,4 @@ import {APIProvider, APIResponse, FetchProvider, FetchProviderOptions} from './provider' | ||
get error() { | ||
return (this.response.json ? this.response.json.error : undefined) as | ||
| APIErrorData | ||
| undefined | ||
const {json} = this.response | ||
return (json ? json.error : undefined) as APIErrorData | undefined | ||
} | ||
@@ -82,3 +81,4 @@ | ||
get name() { | ||
return this.error ? this.error.name : 'unspecified' | ||
const {error} = this | ||
return error ? error.name : 'unspecified' | ||
} | ||
@@ -88,3 +88,4 @@ | ||
get code() { | ||
return this.error ? this.error.code : 0 | ||
const {error} = this | ||
return error ? error.code : 0 | ||
} | ||
@@ -94,3 +95,4 @@ | ||
get details() { | ||
return this.error ? this.error.details : [] | ||
const {error} = this | ||
return error ? error.details : [] | ||
} | ||
@@ -148,6 +150,4 @@ } | ||
const response = await this.provider.call(args) | ||
if ( | ||
Math.floor(response.status / 100) !== 2 || | ||
(response.json && typeof response.json.error === 'object') | ||
) { | ||
const {json} = response | ||
if (Math.floor(response.status / 100) !== 2 || (json && typeof json.error === 'object')) { | ||
throw new APIError(args.path, response) | ||
@@ -154,0 +154,0 @@ } |
@@ -29,2 +29,6 @@ import {APIMethods} from './client' | ||
fetch?: Fetch | ||
/** | ||
* Headers that will be applied to every request | ||
* */ | ||
headers?: Record<string, string> | ||
} | ||
@@ -36,2 +40,3 @@ | ||
readonly fetch: Fetch | ||
readonly headers: Record<string, string> = {} | ||
@@ -42,2 +47,5 @@ constructor(url: string, options: FetchProviderOptions = {}) { | ||
this.url = url | ||
if (options.headers) { | ||
this.headers = options.headers | ||
} | ||
if (!options.fetch) { | ||
@@ -65,2 +73,3 @@ if (typeof window !== 'undefined' && window.fetch) { | ||
const reqHeaders = { | ||
...this.headers, | ||
...args.headers, | ||
@@ -67,0 +76,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2030564
34959
0