foo-webview-sdk
    Preparing search index...

    Variable httpConst

    http: {
        abort: (requestId: string) => Promise<HttpAbortResponse>;
        delete: {
            (url: string, body?: JsonValue): Promise<HttpGetResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpBinaryRequestOptions,
            ): Promise<HttpBinaryResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpRequestOptions,
            ): Promise<HttpGetResponse>;
        };
        disableDefaultDownloadLogger: () => void;
        download: (
            url: string,
            saveTo: string,
            opts?: HttpDownloadOptions,
        ) => Promise<HttpDownloadResponse>;
        get: {
            (url: string): Promise<HttpGetResponse>;
            (url: string, opts: HttpBinaryRequestOptions): Promise<HttpBinaryResponse>;
            (url: string, opts: HttpRequestOptions): Promise<HttpGetResponse>;
        };
        head: (
            url: string,
            opts?: Omit<HttpRequestOptions, "responseType">,
        ) => Promise<HttpHeadResponse>;
        patch: {
            (url: string, body?: JsonValue): Promise<HttpGetResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpBinaryRequestOptions,
            ): Promise<HttpBinaryResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpRequestOptions,
            ): Promise<HttpGetResponse>;
        };
        post: {
            (url: string, body?: JsonValue): Promise<HttpGetResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpBinaryRequestOptions,
            ): Promise<HttpBinaryResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpRequestOptions,
            ): Promise<HttpGetResponse>;
        };
        put: {
            (url: string, body?: JsonValue): Promise<HttpGetResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpBinaryRequestOptions,
            ): Promise<HttpBinaryResponse>;
            (
                url: string,
                body: JsonValue,
                opts: HttpRequestOptions,
            ): Promise<HttpGetResponse>;
        };
        request: {
            (url: string): Promise<HttpGetSuccess>;
            (url: string, opts: HttpBinaryRequestOptions): Promise<HttpBinarySuccess>;
            (url: string, opts: HttpRequestOptions): Promise<HttpGetSuccess>;
        };
    } = ...

    http — HTTP requests made by the host process.

    Requests are not subject to CORS. Only http and https URLs are allowed, and local or private network addresses fail with PERMISSION_DENIED unless the host setting allows them.

    Body-bearing verbs (post / put / delete / patch) accept the body as a positional argument; the host sends a non-string body as its JSON text.

    Type Declaration

    • abort: (requestId: string) => Promise<HttpAbortResponse>

      Cancel an in-flight HTTP request or download by its requestId.

    • delete: {
          (url: string, body?: JsonValue): Promise<HttpGetResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpBinaryRequestOptions,
          ): Promise<HttpBinaryResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpRequestOptions,
          ): Promise<HttpGetResponse>;
      }

      Send a DELETE request with an optional body.

    • disableDefaultDownloadLogger: () => void

      Detach the default failure logger; see disableDefaultHttpDownloadLogger.

    • download: (
          url: string,
          saveTo: string,
          opts?: HttpDownloadOptions,
      ) => Promise<HttpDownloadResponse>

      Download a URL into a file, creating missing folders.

    • get: {
          (url: string): Promise<HttpGetResponse>;
          (url: string, opts: HttpBinaryRequestOptions): Promise<HttpBinaryResponse>;
          (url: string, opts: HttpRequestOptions): Promise<HttpGetResponse>;
      }

      Send a GET request.

    • Send a HEAD request.

    • patch: {
          (url: string, body?: JsonValue): Promise<HttpGetResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpBinaryRequestOptions,
          ): Promise<HttpBinaryResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpRequestOptions,
          ): Promise<HttpGetResponse>;
      }

      Send a PATCH request with an optional body.

    • post: {
          (url: string, body?: JsonValue): Promise<HttpGetResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpBinaryRequestOptions,
          ): Promise<HttpBinaryResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpRequestOptions,
          ): Promise<HttpGetResponse>;
      }

      Send a POST request with an optional body.

    • put: {
          (url: string, body?: JsonValue): Promise<HttpGetResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpBinaryRequestOptions,
          ): Promise<HttpBinaryResponse>;
          (
              url: string,
              body: JsonValue,
              opts: HttpRequestOptions,
          ): Promise<HttpGetResponse>;
      }

      Send a PUT request with an optional body.

    • request: {
          (url: string): Promise<HttpGetSuccess>;
          (url: string, opts: HttpBinaryRequestOptions): Promise<HttpBinarySuccess>;
          (url: string, opts: HttpRequestOptions): Promise<HttpGetSuccess>;
      }

      Event-driven GET that awaits the http:response event. The host may either respond synchronously (async: false) or queue the request and deliver the result via http:response. A client-side timeout (default 35 s, or opts.timeout + 5000 ms) guards against the event never arriving.

      Unlike the other verbs it resolves with the success branch only. A failure the host reports rejects with an Error whose message is the failure's error; a failure delivered by http:response also carries that payload as the error's response. The client timeout rejects as well, after aborting the host request.