Skip to content

Commit 7788930

Browse files
committed
mcp: use round trip method on func
1 parent 4b5e210 commit 7788930

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

mcp/sse_test.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ func TestSSEServer(t *testing.T) {
3737

3838
var customClientUsed int64
3939
customClient := &http.Client{
40-
Transport: &roundTripperFunc{
41-
fn: func(req *http.Request) (*http.Response, error) {
42-
atomic.AddInt64(&customClientUsed, 1)
43-
return http.DefaultTransport.RoundTrip(req)
44-
},
45-
},
40+
Transport: roundTripperFunc(func(req *http.Request) (*http.Response, error) {
41+
atomic.AddInt64(&customClientUsed, 1)
42+
return http.DefaultTransport.RoundTrip(req)
43+
}),
4644
}
4745

4846
clientTransport := NewSSEClientTransport(httpServer.URL, &SSEClientTransportOptions{
@@ -182,10 +180,8 @@ func TestScanEvents(t *testing.T) {
182180
}
183181

184182
// roundTripperFunc is a helper to create a custom RoundTripper
185-
type roundTripperFunc struct {
186-
fn func(*http.Request) (*http.Response, error)
187-
}
183+
type roundTripperFunc func(*http.Request) (*http.Response, error)
188184

189-
func (f *roundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) {
190-
return f.fn(req)
185+
func (f roundTripperFunc) RoundTrip(req *http.Request) (*http.Response, error) {
186+
return f(req)
191187
}

0 commit comments

Comments
 (0)