Skip to content

Instantly share code, notes, and snippets.

@Juanpe
Last active March 26, 2019 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Juanpe/6707fc371d0a496910d1a9bd008c29e4 to your computer and use it in GitHub Desktop.
Save Juanpe/6707fc371d0a496910d1a9bd008c29e4 to your computer and use it in GitHub Desktop.
class APIClient {
// Rest of code
func buildURLRequest<T: APIRequest>(for request: T) throws -> URLRequest {
return try URLRequestBuilder(with: request.baseURL, path: request.path)
.set(method: request.method)
.set(headers: request.headers)
.set(parameters: request.parameters)
.build()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment