(req *http.Request)
| 1929 | } |
| 1930 | |
| 1931 | func (c *streamableClientConn) setMCPHeaders(req *http.Request) error { |
| 1932 | c.mu.Lock() |
| 1933 | defer c.mu.Unlock() |
| 1934 | |
| 1935 | if c.oauthHandler != nil { |
| 1936 | ts, err := c.oauthHandler.TokenSource(c.ctx) |
| 1937 | if err != nil { |
| 1938 | return err |
| 1939 | } |
| 1940 | if ts != nil { |
| 1941 | token, err := ts.Token() |
| 1942 | if err != nil { |
| 1943 | return err |
| 1944 | } |
| 1945 | if token != nil { |
| 1946 | req.Header.Set("Authorization", "Bearer "+token.AccessToken) |
| 1947 | } |
| 1948 | } |
| 1949 | } |
| 1950 | if c.initializedResult != nil { |
| 1951 | req.Header.Set(protocolVersionHeader, c.initializedResult.ProtocolVersion) |
| 1952 | } |
| 1953 | if c.sessionID != "" { |
| 1954 | req.Header.Set(sessionIDHeader, c.sessionID) |
| 1955 | } |
| 1956 | |
| 1957 | return nil |
| 1958 | } |
| 1959 | |
| 1960 | func (c *streamableClientConn) handleJSON(requestSummary string, resp *http.Response) { |
| 1961 | body, err := io.ReadAll(resp.Body) |
no test coverage detected