Skip to content

fix: handle empty responses in HttpHandler#5

Open
RickieeeDev wants to merge 4 commits into
mainfrom
fix/empty-return-fix
Open

fix: handle empty responses in HttpHandler#5
RickieeeDev wants to merge 4 commits into
mainfrom
fix/empty-return-fix

Conversation

@RickieeeDev
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SDK’s HttpHandler response parsing to avoid throwing when the server returns an empty body (common for 204/205 responses), improving resilience for endpoints that legitimately return no content.

Changes:

  • Added explicit handling for empty HTTP responses (204/205, content-length: 0, empty/whitespace body).
  • Switched JSON parsing flow to read the response body as text first, then parse only when non-empty.
  • Centralized “empty response” behavior via a helper method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/http.ts Outdated
Comment thread src/core/http.ts Outdated
Copy link
Copy Markdown
Contributor

@IamKirbki IamKirbki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why so many different checks

Comment thread src/core/http.ts Outdated
Comment thread src/core/http.ts Outdated
Comment thread src/core/http.ts Outdated
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.

3 participants