Overview
Thenetwork section validates connectivity to external services and APIs. This ensures that required network endpoints are accessible before running your application.
Configuration
Each network check is defined by aNetworkCheck struct (src/config.rs:51) with the following fields:
string
required
The URL to check. Must be a valid HTTP or HTTPS URL.
number
Expected HTTP status code. If specified, the check fails if the response status doesn’t match. If omitted, any successful response (2xx or 3xx) is accepted.
Examples
Basic Connectivity Check
Check that a URL is accessible:Status Code Validation
Verify specific HTTP status codes:Multiple Endpoints
Check connectivity to multiple services:Real-World Examples
Use Cases
External API Availability
Verify that third-party services are accessible:Local Services
Check that required local services are running:Health Checks
Verify application health endpoints:Package Registries
Ensure package registries are accessible:Status Code Behavior
When status_code is Specified
The check succeeds only if the response status matches exactly:
When status_code is Omitted
The check succeeds for any successful HTTP response (2xx or 3xx status codes):
From src/config.rs:54, the
status_code field defaults to None, meaning any successful response is accepted.Common Status Codes
Protocol Support
Network checks support:- HTTP:
http://example.com - HTTPS:
https://example.com - Localhost:
http://localhost:3000 - IP addresses:
http://192.168.1.100:8080 - Custom ports:
http://example.com:8080
Default Behavior
From the struct definition in src/config.rs:51:url: Required field, no defaultstatus_code: Defaults toNone(accepts any 2xx/3xx response)
