mirror of
https://github.com/Tencent/WeKnora.git
synced 2026-06-04 13:30:32 +08:00
fix: ReadEvent incompatible sse data format
This commit is contained in:
@@ -47,6 +47,12 @@ func (r *SSEReader) ReadEvent() (*SSEEvent, error) {
|
||||
return &SSEEvent{Data: []byte(jsonStr)}, nil
|
||||
}
|
||||
|
||||
// 增强兼容性(data:后面没有紧接着一个空格)
|
||||
if strings.HasPrefix(line, "data:") {
|
||||
jsonStr := line[5:]
|
||||
return &SSEEvent{Data: []byte(jsonStr)}, nil
|
||||
}
|
||||
|
||||
// 其他行(如 event:, id: 等)跳过
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user