Commit c822b09
committed
fix: ESM compatibility - avoid direct Response object mutation
Fixes #1429
In ESM environments with node-fetch v3, Response objects are read-only and cannot have new properties added.
This change creates a wrapper object instead of mutating the Response directly, maintaining full backward
compatibility while supporting modern ESM environments.
The wrapper object:
- Contains the custom data and error properties
- Delegates all Response properties and methods to the original response
- Works in both CommonJS and ESM environments
- Maintains the same API surface for consumers1 parent 291d9de commit c822b09
1 file changed
+23
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
202 | 222 | | |
203 | 223 | | |
204 | 224 | | |
| |||
0 commit comments