rn-eventsource icon indicating copy to clipboard operation
rn-eventsource copied to clipboard

Content type check is prone to error if additional params are added

Open yunusyuksel opened this issue 1 year ago • 0 comments

That check to content type "text/event-stream" causes an error, if to content type additional params are added like "charset=utf-8". See here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type. we may check the substring of content type?

if ( responseHeaders && responseHeaders['content-type'] !== 'text/event-stream' ) { this.dispatchEvent({ type: 'error', data: 'unsupported MIME type in response: ' + responseHeaders['content-type'], }); return this.close(); } else if (!responseHeaders) { this.dispatchEvent({ type: 'error', data: 'no MIME type in response', }); return this.close(); }

yunusyuksel avatar Oct 11 '23 15:10 yunusyuksel