Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: streaming export waits for response data before writing entries

Aria7a8c5b2f536a
diff --git a/internal/handlers/network_export.go b/internal/handlers/network_export.go
index 3743bf4d..99407799 100644
--- a/internal/handlers/network_export.go
+++ b/internal/handlers/network_export.go
@@ -401,6 +401,37 @@ func (h *Handlers) HandleNetworkExportStream(w http.ResponseWriter, r *http.Requ
flusher.Flush()
return
}
+
+ // The subscriber fires on requestWillBeSent (entry created) before
+ // responseReceived/loadingFinished populate status, headers, timing.
+ // Wait for the entry to be Finished before exporting it.
+ if !entry.Finished && !entry.Failed {
+ reqID := entry.RequestID
+ waitDeadline := time.After(10 * time.Second)
+ poll := time.NewTicker(200 * time.Millisecond)
+ waitDone:
+ for {
+ select {
+ case <-r.Context().Done():
+ poll.Stop()
+ finalize()
+ return
+ case <-waitDeadline:
+ poll.Stop()
+ if updated, found := buf.Get(reqID); found {
+ entry = updated
+ }
+ break waitDone
+ case <-poll.C:
+ if updated, found := buf.Get(reqID); found && (updated.Finished || updated.Failed) {
+ entry = updated
+ poll.Stop()
+ break waitDone
+ }
+ }
+ }
+ }
+
if !filter.Match(entry) {
continue
}