Skip to content

CDP-5967: resolve on any 2xx status code#192

Merged
sydneycollins-cio merged 2 commits into
mainfrom
sydney/cdp-5967-2xx-success
May 21, 2026
Merged

CDP-5967: resolve on any 2xx status code#192
sydneycollins-cio merged 2 commits into
mainfrom
sydney/cdp-5967-2xx-success

Conversation

@sydneycollins-cio
Copy link
Copy Markdown
Contributor

@sydneycollins-cio sydneycollins-cio commented May 21, 2026

What

Fixes lib/request.ts to resolve on any 2xx response instead of only 200 and 201.

Endpoints that return 202 Accepted (async accept-and-queue) or 204 No Content were being incorrectly surfaced as CustomerIORequestError.

Changes

lib/request.ts — replace res.statusCode == 200 || res.statusCode == 201 with res.statusCode >= 200 && res.statusCode < 300 (using strict !== undefined guard as well per ticket ask).

test/request.ts — add three new tests:

  • resolves on 202 with body
  • resolves on 204 with empty body (returns {})
  • rejects on 300

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.handler to treat any 2xx HTTP response as success (with an explicit statusCode !== undefined guard) instead of only resolving on 200/201, preventing 202/204 responses from being raised as CustomerIORequestError.

Adds tests ensuring the handler resolves for 202 Accepted (returns parsed body) and 204 No Content (returns {}), and still rejects for a 300 response.

Reviewed by Cursor Bugbot for commit d5f5f2d. Bugbot is set up for automated code reviews on this repo. Configure here.

@senechko senechko self-requested a review May 21, 2026 21:34
@sydneycollins-cio sydneycollins-cio merged commit 0db4322 into main May 21, 2026
9 checks passed
@sydneycollins-cio sydneycollins-cio deleted the sydney/cdp-5967-2xx-success branch May 21, 2026 21:38
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