http-request-manager 18.15.10 → 18.15.11

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.
@@ -973,7 +973,7 @@ class StreamingProcessor {
973
973
  return null;
974
974
  case HttpEventType.DownloadProgress:
975
975
  if (event.partialText) {
976
- this.appendToBuffer(event.partialText);
976
+ this.buffer = event.partialText;
977
977
  const parsedData = this.parseBuffer();
978
978
  // Only return NEW items since last parse (progressive updates)
979
979
  const newItems = parsedData.slice(this.lastParsedLength);
@@ -995,7 +995,7 @@ class StreamingProcessor {
995
995
  return null;
996
996
  case HttpEventType.Response:
997
997
  if (event.body) {
998
- this.appendToBuffer(event.body);
998
+ this.buffer = typeof event.body === 'string' ? event.body : this.buffer;
999
999
  const parsedData = this.parseBuffer();
1000
1000
  // Calculate final progress
1001
1001
  const progress = {
@@ -1179,10 +1179,12 @@ function parseStreamData(buffer, contentType, config) {
1179
1179
  */
1180
1180
  function parseNdjson(buffer, config) {
1181
1181
  const results = [];
1182
- const lines = buffer.split('\n').filter(line => line.trim());
1183
- lines.forEach(line => {
1182
+ const lines = buffer.split('\n');
1183
+ // If the buffer doesn't end with \n, the last segment is an incomplete partial line skip it
1184
+ const completeLines = buffer.endsWith('\n') ? lines : lines.slice(0, -1);
1185
+ completeLines.filter(line => line.trim()).forEach(line => {
1184
1186
  const trimmedLine = line.trim();
1185
- if (trimmedLine && trimmedLine.startsWith('{') && trimmedLine.endsWith('}')) {
1187
+ if (trimmedLine && trimmedLine.startsWith('{')) {
1186
1188
  const parsed = safeJsonParse(trimmedLine);
1187
1189
  if (parsed)
1188
1190
  results.push(parsed);
@@ -2954,7 +2956,9 @@ class RequestService extends WebsocketService {
2954
2956
  observe: 'events',
2955
2957
  responseType: 'text',
2956
2958
  reportProgress: true
2957
- }).pipe(tap(data => console.log('STREAM DATA', data)), requestStreaming({ streamType: options.streamType || StreamType.NDJSON }), this.requestStreaming(options), this.handleFinalize())
2959
+ }).pipe(
2960
+ // tap(data => console.log('STREAM DATA', data)),
2961
+ requestStreaming({ streamType: options.streamType || StreamType.NDJSON }), this.requestStreaming(options), this.handleFinalize())
2958
2962
  : this.http.get(urlPath, headers).pipe(this.request(options));
2959
2963
  }
2960
2964
  createRecordRequest(options, data) {