boot static method

Future<SparkyTestClient> boot({
  1. required List<Route> routes,
  2. OpenApiConfig? openApi,
  3. MetricsConfig? metrics,
  4. HealthCheckConfig? health,
  5. SchedulerConfig? scheduler,
  6. Route? routeNotFound,
  7. Pipeline? pipelineBefore,
  8. Pipeline? pipelineAfter,
  9. int? maxBodySize,
  10. Duration? requestTimeout,
  11. bool enableGzip = false,
  12. int gzipMinLength = 0,
  13. Duration? cacheTtl,
  14. int? cacheMaxEntries,
})

Boots a Sparky server on a random port and returns a test client.

All server configuration options are supported. The server is always created with port: 0 (OS-assigned) and logConfig: LogConfig.none by default to keep test output clean.

Implementation

static Future<SparkyTestClient> boot({
  required List<Route> routes,
  OpenApiConfig? openApi,
  MetricsConfig? metrics,
  HealthCheckConfig? health,
  SchedulerConfig? scheduler,
  Route? routeNotFound,
  Pipeline? pipelineBefore,
  Pipeline? pipelineAfter,
  int? maxBodySize,
  Duration? requestTimeout,
  bool enableGzip = false,
  int gzipMinLength = 0,
  Duration? cacheTtl,
  int? cacheMaxEntries,
}) async {
  final server = Sparky.single(
    routes: routes,
    openApi: openApi,
    metrics: metrics,
    health: health,
    scheduler: scheduler,
    port: 0,
    logConfig: LogConfig.none,
    routeNotFound: routeNotFound,
    pipelineBefore: pipelineBefore,
    pipelineAfter: pipelineAfter,
    maxBodySize: maxBodySize,
    requestTimeout: requestTimeout,
    enableGzip: enableGzip,
    gzipMinLength: gzipMinLength,
    cacheTtl: cacheTtl,
    cacheMaxEntries: cacheMaxEntries,
  );
  await server.ready;
  return SparkyTestClient._(server);
}