Skip to content

Conversation

devcrocod
Copy link
Contributor

quick fix #308

How Has This Been Tested?

locally

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@devcrocod devcrocod requested review from Copilot and kpavlov October 9, 2025 16:51
Copy link
Contributor

@Copilot 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 fixes the Streamable handling to properly support JSON-only responses, addressing issue #308. The change improves compatibility with servers that don't support Server-Sent Events (SSE) by checking the response content type.

  • Added content type checking for JSON responses in SSE error handling
  • Enhanced logging to distinguish between method not allowed and JSON-only mode
  • Graceful fallback when server returns JSON instead of SSE

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +237 to +238
val responseStatus = e.response?.status
val responseContentType = e.response?.contentType()
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider extracting the response object to a local variable to avoid repeated null-safe calls and improve readability: val response = e.response

Suggested change
val responseStatus = e.response?.status
val responseContentType = e.response?.contentType()
val response = e.response
val responseStatus = response?.status
val responseContentType = response?.contentType()

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@kpavlov kpavlov left a comment

Choose a reason for hiding this comment

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

Tests are needed.

@kpavlov kpavlov added the question Further information is requested label Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StreamableHttpClientTransport fails when server uses JSON-only

2 participants