fix: buffer not return event show errors (#149)

This commit is contained in:
Joel 2023-05-22 16:05:08 +08:00 committed by GitHub
parent 54a6571462
commit 2d0d3365ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,7 @@ const handleStream = (response: any, onData: IOnData, onCompleted?: IOnCompleted
if (message.startsWith('data: ')) { // check if it starts with data:
// console.log(message);
bufferObj = JSON.parse(message.substring(6)) // remove data: and parse as json
if (bufferObj.status === 400) {
if (bufferObj.status === 400 || !bufferObj.event) {
onData('', false, {
conversationId: undefined,
messageId: '',