             
             completion?(nil, .requestFailed)
         }
-        
-        dataTask.resume()
-        
-        return dataTask
     }
 }

    }
    
    @discardableResult
    func request(_ target: NewsAPITarget, completion: NewsProviderRequestCallback) -> URLSessionDataTask? {
        let urlRequestBuilder = URLRequestBuilder(url: target.endpoint, headers: ["X-Api-Key": apiKey])
        
        guard let urlRequest = URLRequest(builder: urlRequestBuilder) else {
            completion?(nil, .unknown)
            return nil
        }
        
        let dataTask = urlSession.dataTask(with: urlRequest) { data, response, error in
            if let data = data {
                completion?(data, nil)
                return


import Foundation

typealias NewsProviderRequestCallback = (((Data?, NewsAPIError?) -> ()))

class NewsProvider {
    private let apiKey: String
