MCPcopy Index your code
hub / github.com/coder/coder / BuildUpstreamHeaders

Function BuildUpstreamHeaders

aibridge/intercept/client_headers.go:72–88  ·  view source on GitHub ↗

BuildUpstreamHeaders produces the header set for an upstream SDK request. It starts from the prepared client headers, then preserves specific headers from the SDK-built request that must not be overwritten.

(sdkHeader http.Header, clientHeaders http.Header, authHeaderName string)

Source from the content-addressed store, hash-verified

70// It starts from the prepared client headers, then preserves specific
71// headers from the SDK-built request that must not be overwritten.
72func BuildUpstreamHeaders(sdkHeader http.Header, clientHeaders http.Header, authHeaderName string) http.Header {
73 headers := PrepareClientHeaders(clientHeaders)
74
75 // Preserve the auth header set by the SDK from the provider configuration.
76 if v := sdkHeader.Get(authHeaderName); v != "" {
77 headers.Set(authHeaderName, v)
78 }
79
80 // Preserve actor headers injected by aibridge as per-request SDK options.
81 for name, values := range sdkHeader {
82 if IsActorHeader(name) {
83 headers[name] = values
84 }
85 }
86
87 return headers
88}

Callers 4

TestBuildUpstreamHeadersFunction · 0.92
newResponsesServiceMethod · 0.92
newMessagesServiceMethod · 0.92
newCompletionsServiceMethod · 0.92

Calls 4

PrepareClientHeadersFunction · 0.85
IsActorHeaderFunction · 0.85
GetMethod · 0.65
SetMethod · 0.65

Tested by 1

TestBuildUpstreamHeadersFunction · 0.74