Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swalx/fix no feedback missing invalid authtoken #177

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}