File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -135,13 +135,22 @@ func WithBaseURL(baseURL string) SSEOption {
135
135
}
136
136
}
137
137
138
- // WithBasePath adds a new option for setting a static base path
139
- func WithBasePath (basePath string ) SSEOption {
138
+ // WithStaticBasePath adds a new option for setting a static base path
139
+ func WithStaticBasePath (basePath string ) SSEOption {
140
140
return func (s * SSEServer ) {
141
141
s .basePath = normalizeURLPath (basePath )
142
142
}
143
143
}
144
144
145
+ // WithBasePath adds a new option for setting a static base path.
146
+ //
147
+ // Deprecated: Use WithStaticBasePath instead. This will be removed in a future version.
148
+ //
149
+ //go:deprecated
150
+ func WithBasePath (basePath string ) SSEOption {
151
+ return WithStaticBasePath (basePath )
152
+ }
153
+
145
154
// WithDynamicBasePath accepts a function for generating the base path. This is
146
155
// useful for cases where the base path is not known at the time of SSE server
147
156
// creation, such as when using a reverse proxy or when the server is mounted
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ func TestSSEServer(t *testing.T) {
24
24
mcpServer := NewMCPServer ("test" , "1.0.0" )
25
25
sseServer := NewSSEServer (mcpServer ,
26
26
WithBaseURL ("http://localhost:8080" ),
27
- WithBasePath ("/mcp" ),
27
+ WithStaticBasePath ("/mcp" ),
28
28
)
29
29
30
30
if sseServer == nil {
@@ -499,7 +499,7 @@ func TestSSEServer(t *testing.T) {
499
499
500
500
t .Run ("works as http.Handler with custom basePath" , func (t * testing.T ) {
501
501
mcpServer := NewMCPServer ("test" , "1.0.0" )
502
- sseServer := NewSSEServer (mcpServer , WithBasePath ("/mcp" ))
502
+ sseServer := NewSSEServer (mcpServer , WithStaticBasePath ("/mcp" ))
503
503
504
504
ts := httptest .NewServer (sseServer )
505
505
defer ts .Close ()
@@ -717,7 +717,7 @@ func TestSSEServer(t *testing.T) {
717
717
useFullURLForMessageEndpoint := false
718
718
srv := & http.Server {}
719
719
rands := []SSEOption {
720
- WithBasePath (basePath ),
720
+ WithStaticBasePath (basePath ),
721
721
WithBaseURL (baseURL ),
722
722
WithMessageEndpoint (messageEndpoint ),
723
723
WithUseFullURLForMessageEndpoint (useFullURLForMessageEndpoint ),
You can’t perform that action at this time.
0 commit comments