Skip to content

Commit 6d5dbdf

Browse files
Schemaregistry examples (#69) (#113)
* Add restService interfaces to exported types * Bugfix for rest service and oauth
1 parent 251a10a commit 6d5dbdf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

schemaregistry/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@confluentinc/schemaregistry",
3-
"version": "v0.1.17.4-devel",
3+
"version": "v0.1.17.6-devel",
44
"description": "Node.js client for Confluent Schema Registry",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

schemaregistry/rest-service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ export class RestService {
101101
delete this.client.defaults.auth;
102102

103103
const headers = ['logicalCluster', 'identityPoolId'];
104-
const missingHeaders = headers.find(header => bearerAuthCredentials[header as keyof typeof bearerAuthCredentials]);
104+
const missingHeader = headers.find(header => !(header in bearerAuthCredentials));
105105

106-
if (missingHeaders) {
107-
throw new Error(`Bearer auth header '${missingHeaders}' not provided`);
106+
if (missingHeader) {
107+
throw new Error(`Bearer auth header '${missingHeader}' not provided`);
108108
}
109109

110110
this.setHeaders({
@@ -127,14 +127,14 @@ export class RestService {
127127
'issuerEndpointUrl',
128128
'scope'
129129
];
130-
const missingField = requiredFields.find(field => bearerAuthCredentials[field as keyof typeof bearerAuthCredentials]);
130+
const missingField = requiredFields.find(field => !(field in bearerAuthCredentials));
131131

132132
if (missingField) {
133133
throw new Error(`OAuth credential '${missingField}' not provided`);
134134
}
135135
const issuerEndPointUrl = new URL(bearerAuthCredentials.issuerEndpointUrl!);
136136
this.oauthClient = new OAuthClient(bearerAuthCredentials.clientId!, bearerAuthCredentials.clientSecret!,
137-
issuerEndPointUrl.host, issuerEndPointUrl.pathname, bearerAuthCredentials.scope!);
137+
issuerEndPointUrl.origin, issuerEndPointUrl.pathname, bearerAuthCredentials.scope!);
138138
break;
139139
default:
140140
throw new Error('Invalid bearer auth credentials source');

0 commit comments

Comments
 (0)