RAGS - v1.10.0
    Preparing search index...

    Function fetch

    • Performs an HTTP request using libsoup3.

      Requires libsoup3 as an optional runtime dependency. If not available, returns a Response with status 400.

      Parameters

      • url: string

        The URL to fetch

      • options: FetchOptions = {}

        Request options (method, headers, body, params)

      Returns Promise<Response>

      A Response object

      const res = await fetch('https://api.example.com/data');
      const data = await res.json();

      const res2 = await fetch('https://api.example.com/post', {
      method: 'POST',
      body: JSON.stringify({ key: 'value' }),
      headers: { 'Content-Type': 'application/json' },
      });