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

Support nested heartbeat response status in 2xx range #1106

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

alanhamlett
Copy link
Member

The HTTP response needs 201 or 202 because some proxies or other network configurations always return 200 status even for failed requests that don't reach the WakaTime API. Because the WakaTime API never responds to POST heartbeats with 200 status, we want to treat 200 status as an error and save the heartbeats to the local offline db.

But for the nested JSON array in the response content we can accept any 2xx status code.

pkg/api/heartbeat.go Outdated Show resolved Hide resolved
@alanhamlett alanhamlett force-pushed the bugfix/nested-status-code-less-strict branch from a1d98b9 to 3d05897 Compare October 8, 2024 22:32
@alanhamlett alanhamlett merged commit 660b2b9 into develop Oct 8, 2024
21 checks passed
@alanhamlett alanhamlett deleted the bugfix/nested-status-code-less-strict branch October 8, 2024 23:12
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.11%. Comparing base (d32ccc3) to head (3d05897).
Report is 2 commits behind head on develop.

@@             Coverage Diff             @@
##           develop    #1106      +/-   ##
===========================================
- Coverage    63.11%   63.11%   -0.01%     
===========================================
  Files          383      383              
  Lines        16565    16564       -1     
===========================================
- Hits         10455    10454       -1     
  Misses        5541     5541              
  Partials       569      569              
Flag Coverage Δ
unittests 63.11% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/api/heartbeat.go 79.06% <100.00%> (ø)
pkg/offline/offline.go 55.61% <100.00%> (-0.13%) ⬇️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants