Skip to main content

get(url:headers:)

Fetches data from the specified URL using the GET method.

Declaration

func get(url: URL, headers: [String : String] = [:]) async throws -> (Data, URLResponse)

Return Value

A tuple containing the retrieved data and the URL response.

Discussion

  • url: The URL of the resource to fetch data from.
  • headers: Optional dictionary of headers to include in the request (default: empty).

Note

Any error that may occur during the network request.