Skip to content

Commit

Permalink
Merge pull request #1106 from wakatime/bugfix/nested-status-code-less…
Browse files Browse the repository at this point in the history
…-strict

Support nested heartbeat response status in 2xx range
  • Loading branch information
alanhamlett authored Oct 8, 2024
2 parents d32ccc3 + 3d05897 commit 660b2b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/api/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func parseHeartbeatResponse(data []json.RawMessage) (heartbeat.Result, error) {
return heartbeat.Result{}, fmt.Errorf("failed to parse json status: %s", err)
}

if result.Status >= http.StatusBadRequest {
if result.Status < http.StatusOK || result.Status > 299 {
resultErrors, err := parseHeartbeatResponseError(data[0])
if err != nil {
return heartbeat.Result{}, fmt.Errorf("failed to parse result errors: %s", err)
Expand Down
3 changes: 1 addition & 2 deletions pkg/offline/offline.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ func handleResults(filepath string, results []heartbeat.Result, hh []heartbeat.H
continue
}

if result.Status != http.StatusCreated &&
result.Status != http.StatusAccepted {
if result.Status < http.StatusOK || result.Status > 299 {
withInvalidStatus = append(withInvalidStatus, hh[n])
}
}
Expand Down

0 comments on commit 660b2b9

Please sign in to comment.