Skip to content

Commit e07ba75

Browse files
authored
fix(server): Fix the logic of the WithStateLess function (#387)
Added a check for the stateLess parameter in the WithStateLess function. Only when stateLess is true, set the sessionIdManager to StatelessSessionIdManager. This modification ensures that the behavior of the WithStateLess function is consistent with expectations and improves the robustness of the code.
1 parent 5c49f63 commit e07ba75

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/streamable_http.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ func WithEndpointPath(endpointPath string) StreamableHTTPOption {
4040
// to StatelessSessionIdManager.
4141
func WithStateLess(stateLess bool) StreamableHTTPOption {
4242
return func(s *StreamableHTTPServer) {
43-
s.sessionIdManager = &StatelessSessionIdManager{}
43+
if stateLess {
44+
s.sessionIdManager = &StatelessSessionIdManager{}
45+
}
4446
}
4547
}
4648

0 commit comments

Comments
 (0)