Created
February 21, 2019 02:09
-
-
Save ekscrypto/6d0c774d8736ca4cf4d833779a3e60df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension APIRequest { | |
public static func urlRequest(from request: APIEndpoint) -> URLRequest? { | |
let endpoint = request.endpoint() | |
guard let endpointUrl = URL(string: "\(AppSettings.shared.serverBaseAddress)\(endpoint)") else { | |
return nil | |
} | |
var endpointRequest = URLRequest(url: endpointUrl) | |
endpointRequest.addValue("application/json", forHTTPHeaderField: "Accept") | |
return endpointRequest | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment