head static method

Future<ApiResponse> head(
  1. String path, {
  2. Map<String, String>? headers,
})

Sends an HTTP HEAD request with the given headers to the given URL.

This automatically initializes a new http.Client and closes that client once the request is complete. If you're planning on making multiple requests to the same server, you should use a single http.Client for all of those requests.

指定されたヘッダーを含む HTTP HEAD リクエストを指定された URL に送信します。

これにより、新しい http.Client が自動的に初期化され、リクエストが完了するとそのクライアントが閉じられます。同じサーバーに複数のリクエストを送信する予定がある場合は、それらすべてのリクエストに対して単一の http.Client を使用する必要があります。

Implementation

static Future<ApiResponse> head(
  String path, {
  Map<String, String>? headers,
}) async {
  final url = Uri.parse(path);
  return http.head(
    url,
    headers: headers,
  );
}