Skip to content

Commit 994169a

Browse files
committed
chore: fix typo on ending bracket
1 parent bf0b718 commit 994169a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/base_service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function usesBasicForIam(obj: any): boolean {
9292
// returns true if the string has a curly bracket or quote as the first or last character
9393
// these are common user-issues that we should handle before they get a network error
9494
function badCharAtAnEnd(value: string): boolean {
95-
return value.startsWith('{') || value.startsWith('"') || value.endsWith('{') || value.endsWith('"');
95+
return value.startsWith('{') || value.startsWith('"') || value.endsWith('}') || value.endsWith('"');
9696
}
9797

9898
// checks credentials for common user mistakes of copying {, }, or " characters from the documentation

test/unit/baseService.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ describe('BaseService', function() {
340340
function assertConstructorThrows(params) {
341341
expect(() => {
342342
new TestService(params);
343-
}).toThrowError('Revise these credentials - they should not start with a { or "');
343+
}).toThrowError(
344+
'Revise these credentials - they should not start or end with curly brackets or quotes.'
345+
);
344346
}
345347

346348
it('should throw when username starts with {', function() {
@@ -391,6 +393,14 @@ describe('BaseService', function() {
391393
});
392394
});
393395

396+
it('should throw when url ends with }', function() {
397+
assertConstructorThrows({
398+
username: 'batman',
399+
password: 'goodpass',
400+
url: 'watson-url.com/some-api/v1/endpoint}',
401+
});
402+
});
403+
394404
it('should throw when url starts with "', function() {
395405
assertConstructorThrows({
396406
username: 'batman',

0 commit comments

Comments
 (0)