Skip to content

Commit

Permalink
check test connection status code
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirianni committed Nov 19, 2024
1 parent 5820764 commit 117d9e6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,16 @@ func NewBindPlane(config *config.Config, logger *zap.Logger) (*BindPlane, error)
// Version queries the BindPlane API for the version information
func (b *BindPlane) Version(_ context.Context) (version.Version, error) {
v := version.Version{}
_, err := b.client.R().SetResult(&v).Get("/version")
return v, err
r, err := b.client.R().SetResult(&v).Get("/version")
if err != nil {
return v, fmt.Errorf("failed to get version: %w", err)
}

if r.StatusCode() != 200 {
return v, fmt.Errorf("failed to get version: %s", r.String())
}

return v, nil
}

// Apply applies a list of resources to the BindPlane API
Expand Down

0 comments on commit 117d9e6

Please sign in to comment.