formatting and update changelog

pull/2479/head
adrieljss 5 months ago
parent acafdd84d8
commit d75de7bc72
No known key found for this signature in database
GPG Key ID: 849F13CBD0B4AD05

@ -0,0 +1,6 @@
---
"http": minor
"http-js": minor
---
Add stream support for HTTP stream responses.

@ -200,9 +200,9 @@ export async function fetch(
// close when the signal to close (an empty chunk) // close when the signal to close (an empty chunk)
// is sent from the IPC. // is sent from the IPC.
if (res instanceof ArrayBuffer if (
? res.byteLength == 0 res instanceof ArrayBuffer ? res.byteLength == 0 : res.length == 0
: res.length == 0) { ) {
controller.close() controller.close()
return return
} }

@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
use std::{future::Future, pin::Pin, str::FromStr, sync::Arc, time::Duration}; use std::{future::Future, pin::Pin, str::FromStr, sync::Arc, time::Duration};
use http::{header, HeaderMap, HeaderName, HeaderValue, Method, StatusCode}; use http::{header, HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
@ -179,7 +178,7 @@ pub async fn fetch<R: Runtime>(
client_config: ClientConfig, client_config: ClientConfig,
command_scope: CommandScope<Entry>, command_scope: CommandScope<Entry>,
global_scope: GlobalScope<Entry>, global_scope: GlobalScope<Entry>,
stream_channel: Channel<tauri::ipc::InvokeResponseBody> stream_channel: Channel<tauri::ipc::InvokeResponseBody>,
) -> crate::Result<ResourceId> { ) -> crate::Result<ResourceId> {
let ClientConfig { let ClientConfig {
method, method,
@ -328,7 +327,6 @@ pub async fn fetch<R: Runtime>(
Ok(res) Ok(res)
}; };
let mut resources_table = webview.resources_table(); let mut resources_table = webview.resources_table();
let rid = resources_table.add_request(Box::pin(fut)); let rid = resources_table.add_request(Box::pin(fut));

Loading…
Cancel
Save