-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver_test.go
More file actions
41 lines (35 loc) · 962 Bytes
/
server_test.go
File metadata and controls
41 lines (35 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package flashduty
import (
"context"
"io"
"log/slog"
"net/http"
"reflect"
"testing"
"github.com/flashcatcloud/flashduty-mcp-server/pkg/translations"
)
func TestNewStreamableHTTPServer_DoesNotDisableStreaming(t *testing.T) {
t.Parallel()
mcpServer, err := NewMCPServer(FlashdutyConfig{
Version: "test",
Translator: translations.NullTranslationHelper,
EnabledToolsets: []string{"incidents"},
})
if err != nil {
t.Fatalf("failed to create MCP server: %v", err)
}
httpServer := newStreamableHTTPServer(
mcpServer,
slog.New(slog.NewTextHandler(io.Discard, nil)),
func(ctx context.Context, _ *http.Request) context.Context {
return ctx
},
)
value := reflect.ValueOf(httpServer).Elem().FieldByName("disableStreaming")
if !value.IsValid() {
t.Fatal("expected streamable HTTP server to expose disableStreaming field")
}
if value.Bool() {
t.Fatal("expected streaming to remain enabled for GET/SSE clients")
}
}