Skip to content

Commit

Permalink
API: Improve error when server does not give an expires header
Browse files Browse the repository at this point in the history
Otherwise it gives a cryptic error during parsing
  • Loading branch information
jwijenbergh committed Aug 30, 2024
1 parent 3a51c1e commit 9c408b3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ func (a *API) Connect(ctx context.Context, prof profiles.Profile, protos []proto

// Parse expiry
expH := h.Get("expires")
if expH == "" {
return nil, errors.New("the server did not give an expires header")
}
expT, err := http.ParseTime(expH)
if err != nil {
return nil, fmt.Errorf("failed parsing expiry time: %w", err)
Expand Down

0 comments on commit 9c408b3

Please sign in to comment.