fix: empty files when saving large response bodies#10160
Conversation
|
|
1 similar comment
|
|
c36ffa6 to
20c84a0
Compare
There was a problem hiding this comment.
Pull request overview
Fixes the “empty file” regression when saving large response bodies by allowing the save helper to load the body from disk when the in-memory bodyBuffer is absent. This aligns the response save flow with the existing oversized-response storage model (bodies can live on disk via bodyPath).
Changes:
- Extend
downloadResponseBody(...)to accept an optional async body loader and use it whenactiveResponse.bodyBufferisnull/undefined. - Wire the response pane’s “download body” action to pass a loader backed by
services.helpers.getResponseBodyBuffer(activeResponse). - Add unit tests covering raw and prettified JSON exports when
bodyBufferisnull.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/insomnia/src/ui/components/panes/response-pane.tsx | Passes a filesystem-backed body loader into the download helper for large/on-disk responses. |
| packages/insomnia/src/ui/components/panes/response-pane-utils.ts | Adds loader support and writes resolved body bytes/string instead of only response.bodyBuffer. |
| packages/insomnia/src/ui/components/panes/tests/response-pane-utils.test.ts | Adds regression tests for disk-backed body loading in both prettified JSON and raw export paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Circular References ReportGenerated at: 2026-06-25T03:50:14.545Z Summary
Click to view all circular references in PR (9)Click to view all circular references in base branch (9)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
Large responses are intentionally not kept in memory to avoid freezing the preview UI, but the existing save flow only wrote
response.bodyBuffer. For responses stored on disk, that produced an empty file even though the body was available.Save flow
downloadResponseBody(...)to accept a fallback body loader.bodyBufferpopulated.Response pane wiring
response-pane.tsxusingservices.helpers.getResponseBodyBuffer(activeResponse).Uint8Array | nullso the save helper does not need to interpret error strings.Regression coverage
bodyBufferisnullbodyBufferisnull