| 199 | } |
| 200 | |
| 201 | func isStreaming(body []byte, urlPath string) bool { |
| 202 | // The Anthropic SDK's Bedrock middleware extracts "stream" |
| 203 | // from the JSON body and encodes them in the URL path instead. |
| 204 | // See: https://github.com/anthropics/anthropic-sdk-go/blob/4d669338f2041f3c60640b6dd317c4895dc71cd4/bedrock/bedrock.go#L247-L248 |
| 205 | return gjson.GetBytes(body, "stream").Bool() || strings.HasSuffix(urlPath, "invoke-with-response-stream") |
| 206 | } |
| 207 | |
| 208 | func (ms *mockUpstream) writeSSE(w http.ResponseWriter, data []byte) { |
| 209 | ms.t.Helper() |