baseUrlFuture property

Future<String> get baseUrlFuture

Sends a PUT request with a JSON body to the specified uri.

This method sets the 'Content-Type' header to 'application/json'.

uri is the endpoint to send the request to. body is the JSON payload to be sent (can be a Map, List, or primitive value). headers is an optional parameter to provide additional headers.

Returns a TestResponse that can be used for assertions.

Returns the resolved base URL when in ephemeral server mode. Starts the server if needed and returns http://127.0.0.1:<port>.

Implementation

/// Returns the resolved base URL when in ephemeral server mode.
/// Starts the server if needed and returns `http://127.0.0.1:<port>`.
Future<String> get baseUrlFuture async {
  if (_transport is ServerTransport) {
    final server = _transport;
    final port = server.portOrNull ?? await server.ensureServer();
    return 'http://127.0.0.1:$port';
  }
  return 'http://127.0.0.1';
}