boot static method
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,
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);
}