File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff 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
9494function 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
Original file line number Diff line number Diff 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' ,
You can’t perform that action at this time.
0 commit comments