fix: treat 2xx responses as successful - #253
Open
saidM wants to merge 1 commit into
Open
Conversation
saidM
force-pushed
the
fix/accept-all-2xx-responses
branch
from
August 19, 2026 19:55
4739528 to
12dbd5c
Compare
dustinbyrne
reviewed
Aug 19, 2026
dustinbyrne
left a comment
Contributor
There was a problem hiding this comment.
thanks for putting this together @saidM! one small bug described below:
Comment on lines
+281
to
+283
| allow_any_instance_of(PostHog::Transport).to( | ||
| receive(:send).and_return(PostHog::Response.new(status)) | ||
| ) |
Contributor
There was a problem hiding this comment.
a real Net::HTTPNoContent (204) response has a nil body and we JSON parse the body in the transport (lib/posthog/transport.rb), so in this case, it'd actually raise an exception
we should fix / test this
Author
There was a problem hiding this comment.
hey @dustinbyrne, good catch! going to push a fix shortly
Contributor
|
one more thing: check RELEASING.md for release prerequisites. verified commits are also required for us to be able to merge this change. |
saidM
force-pushed
the
fix/accept-all-2xx-responses
branch
from
August 19, 2026 22:04
12dbd5c to
2f228a8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Only
200responses were considered successful, so other successful responses such as201,202, and204triggeredon_error.This updates both the sync client and background worker to accept any 2xx response.
It fixes issue #187
💚 How did you test it?
Added specs covering
201,202, and204responses in both code paths.rake public_api:check: passed📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Used GPT-5.6 in Codex to help implement and test the change. I reviewed the final code.