mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
fix: match Bedrock streaming accept headers (#24781)
> Mux is working on behalf of Mike. ## Summary - Bump `github.com/coder/anthropic-sdk-go` to the corrected Bedrock streaming header fix from coder/anthropic-sdk-go#14. - Match botocore's `InvokeModelWithResponseStream` request shape by using `X-Amzn-Bedrock-Accept` and omitting the HTTP `Accept` header. - Update chatd regression coverage for the corrected header shape. ## Context The previous fix set `Accept: application/vnd.amazon.eventstream`. Real boto3/botocore streaming requests do not send that header. They send `X-Amzn-Bedrock-Accept: application/json`, which is the modeled Bedrock request header for the desired model response MIME type. ## Validation - `go test ./coderd/x/chatd/chatprovider -run 'TestModelFromConfig_Bedrock(StreamingHeaders|StripsAnthropicHeaders)?$' -count=1` - `go mod tidy -diff` - `git diff --check` - pre-commit hook during `git commit`
This commit is contained in:
@@ -1123,7 +1123,7 @@ func TestModelFromConfig_BedrockStreamingHeaders(t *testing.T) {
|
||||
got := testutil.TryReceive(ctx, t, requests)
|
||||
require.NoError(t, got.ReadError)
|
||||
require.Equal(t, "/model/us.anthropic.claude-opus-4-6-v1/invoke-with-response-stream", got.Path)
|
||||
require.Equal(t, "application/vnd.amazon.eventstream", got.Accept)
|
||||
require.Empty(t, got.Accept)
|
||||
require.Equal(t, "application/json", got.BedrockAccept)
|
||||
require.Contains(t, got.Authorization, "AWS4-HMAC-SHA256")
|
||||
require.Contains(t, got.Authorization, "x-amzn-bedrock-accept")
|
||||
|
||||
Reference in New Issue
Block a user