driverRequestManagement method

  1. @protected
Future<Response> driverRequestManagement(
  1. Uri url, {
  2. required RequestType type,
  3. Map<String, String>? headers,
  4. Object? body,
  5. Encoding? encoding,
  6. Object? options,
})

Manages the request execution on the client based on the RequestType.

This method is marked as @protected and can be overridden if custom logic is required before the client execution.

Implementation

@protected
Future<Response> driverRequestManagement(
  Uri url, {
  required RequestType type,
  Map<String, String>? headers,
  Object? body,
  Encoding? encoding,
  Object? options,
}) {
  // Note: The 'options' parameter from data_shaft is currently
  // preserved for future compatibility if ncc's BaseClient adds
  // extra configuration support.
  return switch (type) {
    RequestType.get => client.get(url, headers: headers),
    RequestType.delete => client.delete(
        url,
        headers: headers,
        body: body,
        encoding: encoding,
      ),
    RequestType.post => client.post(
        url,
        headers: headers,
        body: body,
        encoding: encoding,
      ),
    RequestType.put => client.put(
        url,
        headers: headers,
        body: body,
        encoding: encoding,
      ),
    RequestType.patch => client.patch(
        url,
        headers: headers,
        body: body,
        encoding: encoding,
      ),
    RequestType.head => client.head(url, headers: headers),
  };
}