docs: Add file download/blob examples for RestEndpoint.parseResponse#3818
docs: Add file download/blob examples for RestEndpoint.parseResponse#3818
Conversation
Document how to override parseResponse for binary responses (blob, arrayBuffer) including Content-Disposition header parsing and browser download trigger pattern. Made-with: Cursor
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3818 +/- ##
=======================================
Coverage 98.06% 98.06%
=======================================
Files 151 151
Lines 2843 2843
Branches 556 556
=======================================
Hits 2788 2788
Misses 11 11
Partials 44 44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Motivation
There was no documentation showing how to use
RestEndpointfor non-JSON responses like file downloads. Users had to piece together theparseResponseoverride pattern themselves. This is a common use case (downloading PDFs, images, exports) that deserves first-class documentation.Solution
Added file download / blob response documentation in three places with progressive disclosure:
docs/rest/api/RestEndpoint.md(parseResponsesection): Added a "File downloads" subsection with a simple blob example and a full example extracting filename fromContent-Dispositionheader. Links to the guide for complete usage.docs/rest/guides/network-transform.md: Added a "File download" section with the complete pattern including endpoint definition and aDownloadButtonReact component showing browser download trigger viaURL.createObjectURL..cursor/skills/data-client-rest/SKILL.md: Added non-JSON response pattern under lifecycle methods with a concise example and link to the full guide reference. Updated skill description with trigger terms (file download, blob, parseResponse).Open questions
N/A
Made with Cursor
Note
Low Risk
Low risk: documentation-only changes with no runtime code modifications. Main risk is minor doc inaccuracies or link/anchor mismatches.
Overview
Documents how to handle non-JSON/binary responses (file downloads) with
@data-client/restby overridingRestEndpoint.parseResponse()to useresponse.blob()/response.arrayBuffer(), and recommendingschema: undefinedplusdataExpiryLength: 0to avoid normalization and blob caching.Adds progressively more complete examples across the
RestEndpointAPI docs, thenetwork-transformguide (including a browser download trigger snippet), and the.cursorskill guide, with cross-links via the#file-downloadanchors.Written by Cursor Bugbot for commit acc5f5e. This will update automatically on new commits. Configure here.