UNPKG

@sentry/core

Version:
15 lines (13 loc) • 592 B
function classifyResponseStreaming(res) { if (!res.body) { return { isStreaming: false }; } const contentType = res.headers.get("content-type") ?? ""; const contentLength = res.headers.get("content-length"); if (/^text\/event-stream\b/i.test(contentType) || /^application\/(x-)?ndjson\b/i.test(contentType) || /^application\/stream\+json\b/i.test(contentType) || /^text\/plain\b/i.test(contentType) && !contentLength) { return { isStreaming: true }; } return { isStreaming: false }; } export { classifyResponseStreaming }; //# sourceMappingURL=responseStreaming.js.map