@ricsam/isolate-client 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1098,6 +1098,7 @@ function registerConsoleCallbacks(state, callbacks) {
1098
1098
  return registrations;
1099
1099
  }
1100
1100
  var CALLBACK_STREAM_THRESHOLD = 64 * 1024;
1101
+ var NULL_BODY_STATUSES = new Set([101, 103, 204, 205, 304]);
1101
1102
  function registerFetchCallback(state, callback) {
1102
1103
  const callbackId = state.nextCallbackId++;
1103
1104
  state.callbacksNeedingRequestId.add(callbackId);
@@ -1118,7 +1119,7 @@ function registerFetchCallback(state, callback) {
1118
1119
  const contentLength = response.headers.get("content-length");
1119
1120
  const knownSize = contentLength ? parseInt(contentLength, 10) : null;
1120
1121
  const isNetworkResponse = response.url && (response.url.startsWith("http://") || response.url.startsWith("https://"));
1121
- const shouldStream = isNetworkResponse && response.body && (knownSize === null || knownSize > CALLBACK_STREAM_THRESHOLD);
1122
+ const shouldStream = isNetworkResponse && !NULL_BODY_STATUSES.has(response.status) && !!response.body && (knownSize === null || knownSize > CALLBACK_STREAM_THRESHOLD);
1122
1123
  if (shouldStream && response.body) {
1123
1124
  const streamId = state.nextStreamId++;
1124
1125
  const headers = [];
@@ -1741,4 +1742,4 @@ function handleClientWsClose(isolateId, payload, state) {
1741
1742
  }
1742
1743
  }
1743
1744
 
1744
- //# debugId=075DBBC817BADA7264756E2164756E21
1745
+ //# debugId=9D2040E2D4C3FD6F64756E2164756E21