Skip to content

Commit 0ff1873

Browse files
committed
Omit api key if none is provided
1 parent 98fe44e commit 0ff1873

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/HttpClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,15 @@ export default class ApiClient implements HttpClient {
9292
const fetchRequestOptions: FetchRequestOptions = {
9393
method,
9494
headers: {
95-
Authorization: `ApiKey ${this.config.apiKey}`,
9695
'User-Agent': `warrant-node/${version}`,
9796
'Content-Type': "application/json"
9897
},
9998
};
10099

101100
if (requestOptions?.apiKey) {
102101
fetchRequestOptions.headers['Authorization'] = `ApiKey ${requestOptions.apiKey}`;
102+
} else if (this.config.apiKey) {
103+
fetchRequestOptions.headers['Authorization'] = `ApiKey ${this.config.apiKey}`;
103104
}
104105

105106
if (requestOptions?.baseUrl) {

0 commit comments

Comments
 (0)