Skip to content

fix: handle 401 responses for domain operations (SWG-20526) - #668

Draft
ewaostrowska wants to merge 1 commit into
mainfrom
claude/swaggerhub-registry-pr-2958-01uwok
Draft

fix: handle 401 responses for domain operations (SWG-20526)#668
ewaostrowska wants to merge 1 commit into
mainfrom
claude/swaggerhub-registry-pr-2958-01uwok

Conversation

@ewaostrowska

Copy link
Copy Markdown

Summary

Follows registry PR #2958 (SWG-20526), which made these spec-correctness fixes to domain operations:

  • saveDomainDefinition now returns 400 (blank body) and 415 (unsupported content type) instead of 500
  • deleteDomain, deleteDomainVersion, renameDomain, forkDomain, cloneDomain now return 401 for invalid tokens instead of the undocumented 403

Changes

src/support/command/handle-response.js

filterResponseMessaging previously only rejected 403 responses. Added 401 to the condition as defense-in-depth: if a 401 response ever reaches this function (e.g. via a future resolveStatus: [401]), it is rejected and surfaced as an error rather than silently passed to onResolve. In the current call sites 401 is already caught earlier by checkForErrors, so this is a safeguard for future code.

Tests

Added tests that verify the CLI correctly surfaces errors for the new response codes from the registry:

Test file New cases
test/commands/domain/create.test.js 401 on POST (invalid API key), 415 on POST (unsupported content type)
test/commands/domain/delete.test.js 401 on DELETE (invalid API key)
test/commands/domain/update.test.js 401 on POST (invalid API key), 415 on POST (unsupported content type)

All 435 existing tests continue to pass.


Generated by Claude Code

…anges (SWG-20526)

Registry PR #2958 (SWG-20526) updated domain operations (saveDomainDefinition,
deleteDomain, deleteDomainVersion) to return 401 for invalid tokens instead of
the previous undocumented behavior, and to return 400/415 instead of 500 for
malformed/unsupported requests.

- Add 401 to filterResponseMessaging as defense-in-depth: if 401 ever reaches
  this function via resolveStatus it is rejected rather than silently passed
  to onResolve
- Add 401 tests for domain:create, domain:delete, and domain:update
- Add 415 tests for domain:create and domain:update (saveDomainDefinition
  now returns 415 for unsupported content types instead of 500)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016stuqDZQnQDtZD5XTqj635
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