support 405 response from servers that don’t support streaming (#90)
* support 405 response from servers that don’t support streaming * Rephrase comment --------- Co-authored-by: Stephen Tallent <stallent@mercury.io> Co-authored-by: Mattt Zmuda <mattt@loopwork.com>
This commit is contained in:
parent
f6e401aa97
commit
ccb070f2f0
1 changed files with 6 additions and 0 deletions
|
|
@ -205,6 +205,12 @@ public actor HTTPClientTransport: Actor, Transport {
|
|||
|
||||
// Check response status
|
||||
guard httpResponse.statusCode == 200 else {
|
||||
// If the server returns 405 Method Not Allowed,
|
||||
// it indicates that the server doesn't support SSE streaming.
|
||||
// We should cancel the task instead of retrying the connection.
|
||||
if httpResponse.statusCode == 405 {
|
||||
self.streamingTask?.cancel()
|
||||
}
|
||||
throw MCPError.internalError("HTTP error: \(httpResponse.statusCode)")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue