mirror of
https://github.com/alibaba/higress.git
synced 2026-05-29 23:27:28 +08:00
fix(golang-filter): fix bug of stop and buffer in decode data (#2754)
This commit is contained in:
@@ -509,6 +509,11 @@ func (m *McpServerController) constructMcpSessionStruct(mcp *McpServer) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *McpServerController) constructMcpServerStruct(mcp *McpServer) string {
|
func (m *McpServerController) constructMcpServerStruct(mcp *McpServer) string {
|
||||||
|
// if no servers, return empty string
|
||||||
|
if mcp == nil || len(mcp.Servers) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// Build servers configuration
|
// Build servers configuration
|
||||||
servers := "[]"
|
servers := "[]"
|
||||||
if len(mcp.Servers) > 0 {
|
if len(mcp.Servers) > 0 {
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ func (f *filter) DecodeHeaders(header api.RequestHeaderMap, endStream bool) api.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f *filter) DecodeData(buffer api.BufferInstance, endStream bool) api.StatusType {
|
func (f *filter) DecodeData(buffer api.BufferInstance, endStream bool) api.StatusType {
|
||||||
if !endStream {
|
|
||||||
return api.StopAndBuffer
|
|
||||||
}
|
|
||||||
if f.message {
|
if f.message {
|
||||||
for _, server := range f.config.servers {
|
for _, server := range f.config.servers {
|
||||||
if f.path == server.BaseServer.GetMessageEndpoint() {
|
if f.path == server.BaseServer.GetMessageEndpoint() {
|
||||||
|
if !endStream {
|
||||||
|
return api.StopAndBuffer
|
||||||
|
}
|
||||||
// Create a response recorder to capture the response
|
// Create a response recorder to capture the response
|
||||||
recorder := httptest.NewRecorder()
|
recorder := httptest.NewRecorder()
|
||||||
// Call the handleMessage method of SSEServer with complete body
|
// Call the handleMessage method of SSEServer with complete body
|
||||||
|
|||||||
Reference in New Issue
Block a user