Skip to content

Commit

Permalink
trim-slash-for-base-url
Browse files Browse the repository at this point in the history
  • Loading branch information
Eli Fabens committed Apr 28, 2021
1 parent 1b35697 commit d4db273
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,8 @@ type TozIDLoginRequest struct {
func GetSDKV3ForTozIDUser(login TozIDLoginRequest) (*ToznySDKV3, error) {
if login.APIBaseURL == "" {
login.APIBaseURL = "https://api.e3db.com"
} else {
login.APIBaseURL = strings.TrimSuffix(login.APIBaseURL, "/")
}
username := strings.ToLower(login.Username)
anonConfig := e3dbClients.ClientConfig{
Expand Down
8 changes: 4 additions & 4 deletions identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

func TestToznySDKV3_Login(t *testing.T) {
request := TozIDLoginRequest{
Username: "",
Password: "",
RealmName: "",
Username: "efabens",
Password: "Password1!",
RealmName: "elitestrealm20201020",
APIBaseURL: "https://api.e3db.com",
LoginHandler: mfaHandler,
}
Expand All @@ -23,7 +23,7 @@ func TestToznySDKV3_Login(t *testing.T) {
func mfaHandler(sessionResponse *IdentitySessionIntermediateResponse) (LoginActionData, error) {
if sessionResponse.LoginActionType == "login-totp" {
totpValue := make(map[string]string)
totpValue["otp"] = ""
totpValue["otp"] = "540745"
return totpValue, nil
}
return nil, fmt.Errorf("mfaHandler cannot support \"%s\" action types", sessionResponse.LoginActionType)
Expand Down

0 comments on commit d4db273

Please sign in to comment.