mcp: correctly disallow GET requests on stateless servers
The condition sessionID == "" was not quite right for disallowing GET requests. Since we decided to differentiate "stateless" vs "sessionless" servers, we need to disallow GET requests for both. For #393
This commit is contained in:
parent
92e19c1be8
commit
a1eb4849b7
1 changed files with 23 additions and 15 deletions
|
|
@ -171,7 +171,7 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque
|
|||
|
||||
switch req.Method {
|
||||
case http.MethodPost, http.MethodGet:
|
||||
if req.Method == http.MethodGet && sessionID == "" {
|
||||
if req.Method == http.MethodGet && (h.opts.Stateless || sessionID == "") {
|
||||
http.Error(w, "GET requires an active session", http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue