Last active
June 21, 2020 13:58
-
-
Save Plnda/dea929b667fdcae7fdf9eaf4048a6227 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
import Foundation | |
protocol NetworkRoute { | |
var path: String { get } | |
var method: NetworkMethod { get } | |
var headers: [String: String]? { get } | |
} | |
extension NetworkRoute { | |
var headers: [String : String]? { | |
return nil | |
} | |
func create(for enviroment: NetworkEnviroment) -> URLRequest { | |
var request = URLRequest(url: URL(string: enviroment.rawValue + path)!) | |
request.allHTTPHeaderFields = headers | |
request.httpMethod = method.rawValue.uppercased() | |
return request | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line16: NetworkEnviroment
should be
NetworkEnvironment?