From dbbb8c6e32eb8c3cf4df1e737beb6d92410ab6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=90=E4=BA=9A=E7=91=9F?= Date: Thu, 5 Dec 2024 17:47:13 +0800 Subject: [PATCH] feat: add response header to open event sometime we need get data from response header, now we can do it. --- src/EventSource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventSource.js b/src/EventSource.js index 6a7b146..71b4f93 100644 --- a/src/EventSource.js +++ b/src/EventSource.js @@ -108,7 +108,7 @@ class EventSource { if (xhr.status >= 200 && xhr.status < 400) { if (this.status === this.CONNECTING) { this.status = this.OPEN; - this.dispatch('open', { type: 'open' }); + this.dispatch('open', { type: 'open', responseHeaders: xhr.responseHeaders }); this._logDebug('[EventSource][onreadystatechange][OPEN] Connection opened.'); }