Member Junction
    Preparing search index...
    • Sends a HEAD request. Shorthand for HttpRequest with Method: 'HEAD'.

      ResponseType is forced to none because a HEAD response has no body by definition, so Data is always null — use Status and Headers. Pair with ThrowOnError: false when probing a URL's reachability, so a 4xx is reported as a status rather than thrown.

      Type Parameters

      • T = unknown

        unused in practice; Data is always null.

      Parameters

      • url: string

        absolute URL, or a path when config.BaseURL is supplied.

      • Optionalconfig: Omit<HttpRequestConfig, "Url" | "Method" | "Body">

        optional per-request settings.

      Returns Promise<HttpResponse<T>>

      the HttpResponse, with Data set to null.

      on a non-2xx status (unless ThrowOnError is disabled), timeout, cancellation, or transport failure.

      const response = await HttpHead(url, { ThrowOnError: false, Timeout: 10000 });
      const reachable = response.Status >= 200 && response.Status < 400;