Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

net::ERR_HTTP2_PROTOCOL_ERROR 200 (OK) and abortController don't work

Đang mở
#78 4 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với lệnh gọi fetchEventSource được cung cấp và kiểm tra cách callback onerror, signal của AbortController và hành vi retry tương tác với nhau trong một yêu cầu streaming. Tái hiện kịch bản net::ERR_HTTP2_PROTOCOL_ERROR lặp lại và xác minh rằng việc abort trong onerror sẽ dừng các yêu cầu tiếp theo và việc phân phối stream.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

const abortController = new AbortController()
  await fetchEventSource(
    `https://xxx/xx/xx/xx?query=${questionSended}&dialog_id=${this.currentDialogID}&is_stream=1`,
    {
      headers: {
        Authorization: userinfo.token
      },
      signal: abortController.signal,
      openWhenHidden: true,
      onopen: async response => {
        console.log('onopen', response)
        if (response.status !== 200) {
          throw new Error(`${response.status}(${response.statusText})`)
        }
        return
      },
      onmessage: res => {
        const data = JSON.parse(res.data)
        console.log(data)
        if (data.plugin_id) return
        if (data.error_code) {
          throw new Error(`${data.error_code}(${data.error_msg})`)
        }
        if (data.prompt) {
          this.relatedQuestion = data.prompt
        } else {
     
        }
      },
      onclose: () => {
        console.log('closed')
      },
      onerror: err => {
        console.log('err', err)
        if (abortController.signal.aborted) return
        this.dialogDetailList[contextIndex].answer =
          'error'
        abortController.abort()
      }
    }
  )

The error occured in the middle of request, and the browser start another request to continue receiving stream data. And the same error occured. such back and forth
And l can read true value of 'abortController.signal.aborted' in error callback, but the request still continue

Ngôn ngữ chính
TypeScript
Star
2.9k
Fork
197
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Azure/fetch-event-source

Tất cả issue của Azure/fetch-event-source

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.