This is the changelog for response. It follows semantic versioning.
- Bumped
@remix-run/*dependencies:
- Bumped
@remix-run/*dependencies:
- Bumped
@remix-run/*dependencies:
- Bumped
@remix-run/*dependencies:
- Bumped
@remix-run/*dependencies:
- Bumped
@remix-run/*dependencies:
- Changed
@remix-run/*peer dependencies to regular dependencies
-
createFileResponse()is now generic and accepts any file-like objectThe function now accepts any object satisfying the
FileLikeinterface, which includes both nativeFileandLazyFilefrom@remix-run/lazy-file. This change supports the updatedLazyFileclass which no longer extends nativeFile.The generic type flows through to the
digestcallback in options, so you get the exact type you passed in:// With native File - digest receives File createFileResponse(nativeFile, request, { digest: async (file) => { /* file is typed as File */ }, }) // With LazyFile - digest receives LazyFile createFileResponse(lazyFile, request, { digest: async (file) => { /* file is typed as LazyFile */ }, })
-
Add
redirectexport which is a shorthand alias forcreateRedirectResponse
- Update
@remix-run/headerspeer dependency to use the new header parsing methods.
createFileResponsenow includescharsetin Content-Type for text-based files.
-
BREAKING CHANGE: Add
@remix-run/mimeas a peer dependency. This package is used by thecreateFileResponse()response helper to determine if HTTP Range requests should be supported by default for a given MIME type. -
Add
compressResponsehelper -
The
createFileResponse()response helper now only enables HTTP Range requests by default for non-compressible MIME types. This allows text-based assets to be compressed while still supporting resumable downloads for media files.To restore the previous behavior where all files support range requests:
return createFileResponse(file, request, { acceptRanges: true, })
Note: Range requests and compression are mutually exclusive. When
Accept-Ranges: bytesis present in response headers, thecompress()response helper andcompression()middleware will not compress the response.
Initial release with response helpers extracted from @remix-run/fetch-router.
See the README for more details.