@tauri-apps/plugin-http 2.5.6 → 2.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-js/index.cjs +26 -8
- package/dist-js/index.js +26 -8
- package/package.json +2 -2
package/dist-js/index.cjs
CHANGED
|
@@ -155,20 +155,38 @@ async function fetch(input, init) {
|
|
|
155
155
|
void dropBody();
|
|
156
156
|
});
|
|
157
157
|
},
|
|
158
|
-
pull: (controller) => readChunk(controller)
|
|
158
|
+
pull: (controller) => readChunk(controller),
|
|
159
|
+
cancel: () => {
|
|
160
|
+
// Ensure body resources are released on stream cancellation
|
|
161
|
+
void dropBody();
|
|
162
|
+
}
|
|
159
163
|
});
|
|
160
164
|
const res = new Response(body, {
|
|
161
165
|
status,
|
|
162
166
|
statusText
|
|
163
167
|
});
|
|
164
|
-
//
|
|
165
|
-
|
|
166
|
-
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
|
|
168
|
+
// `Response.url` cannot be set via the constructor, so we define it manually
|
|
169
|
+
Object.defineProperty(res, 'url', { value: url, writable: false });
|
|
170
|
+
// Expose `set-cookie` via `response.headers` (and `getSetCookie()` where
|
|
171
|
+
// supported). This is not Fetch-spec compliant for network responses in
|
|
172
|
+
// browsers, where `set-cookie` is treated as a forbidden response
|
|
173
|
+
// header and is generally not readable from JavaScript.
|
|
170
174
|
Object.defineProperty(res, 'headers', {
|
|
171
|
-
value: new Headers(responseHeaders)
|
|
175
|
+
value: new Headers(responseHeaders),
|
|
176
|
+
writable: false
|
|
177
|
+
});
|
|
178
|
+
// Patch clone() per-instance so cloning preserves the overridden properties
|
|
179
|
+
const originalClone = res.clone.bind(res);
|
|
180
|
+
Object.defineProperty(res, 'clone', {
|
|
181
|
+
value: () => {
|
|
182
|
+
const cloned = originalClone();
|
|
183
|
+
Object.defineProperty(cloned, 'url', { value: url, writable: false });
|
|
184
|
+
Object.defineProperty(cloned, 'headers', {
|
|
185
|
+
value: new Headers(responseHeaders),
|
|
186
|
+
writable: false
|
|
187
|
+
});
|
|
188
|
+
return cloned;
|
|
189
|
+
}
|
|
172
190
|
});
|
|
173
191
|
return res;
|
|
174
192
|
}
|
package/dist-js/index.js
CHANGED
|
@@ -153,20 +153,38 @@ async function fetch(input, init) {
|
|
|
153
153
|
void dropBody();
|
|
154
154
|
});
|
|
155
155
|
},
|
|
156
|
-
pull: (controller) => readChunk(controller)
|
|
156
|
+
pull: (controller) => readChunk(controller),
|
|
157
|
+
cancel: () => {
|
|
158
|
+
// Ensure body resources are released on stream cancellation
|
|
159
|
+
void dropBody();
|
|
160
|
+
}
|
|
157
161
|
});
|
|
158
162
|
const res = new Response(body, {
|
|
159
163
|
status,
|
|
160
164
|
statusText
|
|
161
165
|
});
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
|
|
166
|
+
// `Response.url` cannot be set via the constructor, so we define it manually
|
|
167
|
+
Object.defineProperty(res, 'url', { value: url, writable: false });
|
|
168
|
+
// Expose `set-cookie` via `response.headers` (and `getSetCookie()` where
|
|
169
|
+
// supported). This is not Fetch-spec compliant for network responses in
|
|
170
|
+
// browsers, where `set-cookie` is treated as a forbidden response
|
|
171
|
+
// header and is generally not readable from JavaScript.
|
|
168
172
|
Object.defineProperty(res, 'headers', {
|
|
169
|
-
value: new Headers(responseHeaders)
|
|
173
|
+
value: new Headers(responseHeaders),
|
|
174
|
+
writable: false
|
|
175
|
+
});
|
|
176
|
+
// Patch clone() per-instance so cloning preserves the overridden properties
|
|
177
|
+
const originalClone = res.clone.bind(res);
|
|
178
|
+
Object.defineProperty(res, 'clone', {
|
|
179
|
+
value: () => {
|
|
180
|
+
const cloned = originalClone();
|
|
181
|
+
Object.defineProperty(cloned, 'url', { value: url, writable: false });
|
|
182
|
+
Object.defineProperty(cloned, 'headers', {
|
|
183
|
+
value: new Headers(responseHeaders),
|
|
184
|
+
writable: false
|
|
185
|
+
});
|
|
186
|
+
return cloned;
|
|
187
|
+
}
|
|
170
188
|
});
|
|
171
189
|
return res;
|
|
172
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-http",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"license": "MIT OR Apache-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tauri-apps/api": "^2.
|
|
27
|
+
"@tauri-apps/api": "^2.10.1"
|
|
28
28
|
}
|
|
29
29
|
}
|