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

[DSET-4072] Include (truncated) response body in the error message in case we fail to parse the response body #29

Merged
merged 8 commits into from
Jun 9, 2023
16 changes: 16 additions & 0 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,19 @@ func TestHttpStatusCodes(t *testing.T) {
})
}
}

func TestAddEventsEndpointUrlTrailingSlashIsHandledCorrectly(t *testing.T) {
zdaratom-s1 marked this conversation as resolved.
Show resolved Hide resolved
t.Setenv("SCALYR_SERVER", "https://app.scalyr.com/")
cfg, err := config.New(config.FromEnv())
assert.Nil(t, err)
sc, err := NewClient(cfg, nil, zap.Must(zap.NewDevelopment()))
require.Nil(t, err)
assert.Equal(t, sc.addEventsEndpointUrl, "https://app.scalyr.com/api/addEvents")

t.Setenv("SCALYR_SERVER", "https://app.scalyr.com/")
zdaratom-s1 marked this conversation as resolved.
Show resolved Hide resolved
cfg2, err := config.New(config.FromEnv())
assert.Nil(t, err)
sc2, err := NewClient(cfg2, nil, zap.Must(zap.NewDevelopment()))
require.Nil(t, err)
assert.Equal(t, sc2.addEventsEndpointUrl, "https://app.scalyr.com/api/addEvents")
}