init(fetching:timeout:includeSubresources:)
Creates a Linkmetadata value from the specified properties by fetching the URL using the specified request.
Declaration
nonisolated init(fetching request: URLRequest, timeout: Duration = .seconds(30), includeSubresources: Bool = true) async throwsParameters
- request:
The URL request to fetch the metadata from.
- timeout:
The time interval after which the request automatically fails if it hasn’t already completed. By default, this is 30 seconds. If a metadata fetch takes longer than the timeout interval, an
Erroris thrown. - includeSubresources:
Determines if subresources should be fetched in addition to the main resource. If
true, additional data will be fetched from the network to provide subresources such as images and icons. Iffalse, no additional networking is done.
Discussion
Metadata fetching supports Task cancellation; if the enclosing Task is cancelled, the metadata request will be cancelled.