HttpWaitStrategy.fromUrl constructor
HttpWaitStrategy.fromUrl(
- String url
Creates an HttpWaitStrategy from a full URL string.
The port, path, and TLS flag are extracted automatically from url.
When the scheme is https, usingTls is called implicitly.
Example:
HttpWaitStrategy.fromUrl('https://localhost:8443/api/health')
Implementation
factory HttpWaitStrategy.fromUrl(String url) {
final parsed = Uri.parse(url);
final effectivePort =
parsed.hasPort ? parsed.port : (parsed.scheme == 'https' ? 443 : 80);
final effectivePath = parsed.path.isEmpty ? '/' : parsed.path;
final strategy = HttpWaitStrategy(effectivePort, path: effectivePath);
if (parsed.scheme == 'https') {
strategy.usingTls();
}
return strategy;
}