Releases: web-widget/shared-cache
v1.7.2
Patch Changes
-
1c29aaa: fix: Comprehensive fix for readonly headers modification issues
This change completely resolves the readonly headers modification problems that were partially addressed in the previous fix. The solution includes:
New Features:
- Added
src/utils/response.tswith intelligent response utilities:modifyResponseHeaders(): Smart header modification with readonly fallbacksetResponseHeader(): Convenient single header setting function
Bug Fixes:
- Fixed
setCacheStatus()function infetch.tsto properly handle readonly headers - Optimized
createInterceptor()function to avoid unnecessary Response cloning - Ensured
cache.tsuses safe header modification patterns - All header modifications now gracefully handle readonly scenarios
Performance Improvements:
- No Response cloning when no header overrides are configured
- Direct header modification when possible (for mutable headers)
- Smart fallback to new Response creation only when necessary
- Significant performance improvement for common use cases
Testing:
- Added comprehensive unit tests for response utilities (10 new tests)
- Added specific tests for createInterceptor readonly headers handling (6 new tests)
- All 258 tests pass with 93.93% code coverage
- Tests cover edge cases, error scenarios, and performance considerations
This fix ensures that header modifications work reliably across all environments (browser, Node.js, etc.) while maintaining optimal performance by avoiding unnecessary object creation.
- Added
v1.7.1
Patch Changes
-
b309ee1: fix: Fix Response headers modification bug in createInterceptor function
The createInterceptor function was attempting to directly modify the Response.headers object, which is read-only in both browser and Node.js environments. This caused the cacheControlOverride and varyOverride options to not work properly.
Changes made:
- Create a new Headers object from the original response headers
- Apply header modifications to the new Headers object
- Create a new Response object with the modified headers
- Return the new Response for successful responses
This fix ensures that cacheControlOverride and varyOverride work correctly for successful responses while maintaining backward compatibility.