CDP-5967: resolve on any 2xx status code#192
Merged
Merged
Conversation
senechko
approved these changes
May 21, 2026
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.
What
Fixes
lib/request.tsto resolve on any 2xx response instead of only 200 and 201.Endpoints that return
202 Accepted(async accept-and-queue) or204 No Contentwere being incorrectly surfaced asCustomerIORequestError.Changes
lib/request.ts— replaceres.statusCode == 200 || res.statusCode == 201withres.statusCode >= 200 && res.statusCode < 300(using strict!== undefinedguard as well per ticket ask).test/request.ts— add three new tests:{})Closes CDP-5967.
Note
Low Risk
Low risk: small change to HTTP success criteria plus targeted tests; behavior only changes for non-200/201 2xx responses that were previously treated as errors.
Overview
Updates
CIORequest.handlerto treat any 2xx HTTP response as success (with an explicitstatusCode !== undefinedguard) instead of only resolving on200/201, preventing202/204responses from being raised asCustomerIORequestError.Adds tests ensuring the handler resolves for
202 Accepted(returns parsed body) and204 No Content(returns{}), and still rejects for a300response.Reviewed by Cursor Bugbot for commit d5f5f2d. Bugbot is set up for automated code reviews on this repo. Configure here.