Skip to content

Commit

Permalink
Merge pull request #1 from swalx/swalx/fix-no-feedback-missing-invali…
Browse files Browse the repository at this point in the history
…d-authtoken

swalx/fix no feedback missing invalid authtoken
  • Loading branch information
swalx authored Jul 24, 2024
2 parents ac81e74 + 368dd44 commit ead7f91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ func Connect(ctx context.Context, opts ...ConnectOption) (Session, error) {
again = false
case again && err != nil: // error on reconnect
errs = multierr.Append(errs, err)
return nil, errs
case !again: // gave up trying to reconnect
errs = multierr.Append(errs, err)
return nil, errs
Expand Down
7 changes: 7 additions & 0 deletions session_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ngrok

import (
"context"
"testing"

"github.com/stretchr/testify/require"
Expand All @@ -20,3 +21,9 @@ func TestUserAgent(t *testing.T) {
}).ToUserAgent()
require.Equal(t, "agent-official-go/3.2.1 ({\"ProxyType\": \"socks5\", \"ConfigVersion\": \"2\"})", s)
}

func TestConnect(t *testing.T) {
// ensure err if token is invalid or is missing
_, err := Connect(context.Background())
require.Error(t, err)
}

0 comments on commit ead7f91

Please sign in to comment.