#Questions Tauri fetch API

1 messages · Page 1 of 1 (latest)

real bone
#

Hi, I'm building an application to make http/s calls (sort of like Postman) but with some more robust capabilities around load/concurrency testing and test scripting. Anyways, I'm looking at Tauri's fetch API and had some questions that I don't see an obvious answer to in the docs. I'm wondering if anybody with experience could point me in the right direction. I'm trying to figure out if I can use Tauri's fetch API for my needs or if I should build a crate w/ reqwest

  1. The fetch function documentation at https://tauri.app/v1/api/js/http#fetch says fetch will "Perform an HTTP request using the default client". Is there a way to use a Client that I create myself? If so...
    1a. After dispatching a fetch call, will Client.drop actually abort the connection, similar to AbortController (https://developer.mozilla.org/en-US/docs/Web/API/AbortController)? The use case here would be a long-running call that the user wants to give up on
  2. If using Tauri's fetch in the Http API, am I going to avoid CORS issues?
  3. If specifying a number for HttpOptions.timeout, is that seconds, milliseconds, something else?
latent lily
#

1. Yes, with getClient. I don't know enough about the internals of the reqwest crate to say what impact dropping the client has on existing connections.
2. Yes, Tauri's fetch was specifically created because of CORS issues.
3. Seconds.