Skip to content

fix: large responses now download correctly [INS-2365]#9807

Open
arora-r wants to merge 8 commits intoKong:developfrom
arora-r:fix/large-response-downloads
Open

fix: large responses now download correctly [INS-2365]#9807
arora-r wants to merge 8 commits intoKong:developfrom
arora-r:fix/large-response-downloads

Conversation

@arora-r
Copy link
Copy Markdown

@arora-r arora-r commented Apr 13, 2026

Users that are requesting endpoints with large responses (>= 5MB) are shown a "Save To File" button in the response pane. Clicking this saves an empty file. Similarly, in the Preview button dropdown the options to export as raw response, prettified response, and http debug were also saving blank files.

The "Export as HAR" option uses the stored response body instead of the current activeResponse.bodyBuffer making it work as expected regardless of the response size. This PR follows similar logic to see if the current bodyBuffer is empty and to fallback into the actual stored response.

I do want to note in this implementation; for large requests I've disabled the export as prettified response to prevent any high memory usage to lower the chance of crashing the app.

[Addresses INS-2365]

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 13, 2026

CLA assistant check
All committers have signed the CLA.

@arora-r arora-r marked this pull request as draft April 13, 2026 15:44
Comment on lines +14 to +15
bodyPath?: string;
bodyCompression?: Compression;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Adding these to show where the file is stored locally, and if we need to decompress because we now can use getBodyBuffer(activeResponse) which is the file in disk instead of the data in memory

@arora-r arora-r marked this pull request as ready for review April 13, 2026 20:03
Comment on lines +42 to +49
app.get('/large-json', (_req, res) => {
const items = Array.from({ length: 100_000 }, (_, i) => ({
id: i,
name: `item-${i}`,
value: 'x'.repeat(100),
}));
res.status(200).json({ items });
});
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generates ~13MB response size

@@ -0,0 +1,50 @@
type: collection.insomnia.rest/5.0
Copy link
Copy Markdown
Author

@arora-r arora-r Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created the collection in the insomnia app and then exported them for this file

@arora-r arora-r requested a review from jackkav April 14, 2026 15:45
@arora-r arora-r changed the title fix: large responses now download correctly fix: large responses now download correctly [INS-2365] Apr 14, 2026
@godfrzero godfrzero requested a review from a team April 14, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants