Skip to content

Commit

Permalink
fix: error correctly if apiUrl is not provided (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris authored Oct 18, 2024
2 parents 2ff8810 + 93a7cbe commit ac1e4bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,6 @@ export class OpenFgaClient extends BaseAPI {
this.configuration = new ClientConfiguration(configuration);
}
this.configuration.isValid();


this.api = new OpenFgaApi(this.configuration, axios);
this.storeId = configuration.storeId;
this.authorizationModelId = configuration.authorizationModelId;
Expand Down
7 changes: 3 additions & 4 deletions configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,9 @@ export class Configuration {
* @throws {FgaValidationError}
*/
public isValid(): boolean {
if (!this.apiUrl) {
assertParamExists("Configuration", "apiScheme", this.apiScheme);
assertParamExists("Configuration", "apiHost", this.apiHost);
}
if (!this.apiUrl && !this.apiHost) {
assertParamExists("Configuration", "apiUrl", this.apiUrl);
}

if (!isWellFormedUriString(this.getBasePath())) {
throw new FgaValidationError(
Expand Down

0 comments on commit ac1e4bb

Please sign in to comment.