forked from loafle/openapi-generator-original
Merge pull request #1492 from tomekc/swift_custom_headers
Custom headers in Swift; base URL is now modifyable
This commit is contained in:
@@ -7,8 +7,9 @@
|
||||
import Foundation
|
||||
|
||||
public class {{projectName}}API {
|
||||
static let basePath = "{{basePath}}"
|
||||
static var credential: NSURLCredential?
|
||||
public static var basePath = "{{basePath}}"
|
||||
public static var credential: NSURLCredential?
|
||||
public static var customHeaders: [String:String] = [:]
|
||||
static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory()
|
||||
}
|
||||
|
||||
@@ -41,6 +42,14 @@ public class RequestBuilder<T> {
|
||||
self.URLString = URLString
|
||||
self.parameters = parameters
|
||||
self.isBody = isBody
|
||||
|
||||
addHeaders({{projectName}}API.customHeaders)
|
||||
}
|
||||
|
||||
public func addHeaders(aHeaders:[String:String]) {
|
||||
for (header, value) in aHeaders {
|
||||
headers[header] = value
|
||||
}
|
||||
}
|
||||
|
||||
public func execute(completion: (response: Response<T>?, erorr: ErrorType?) -> Void) { }
|
||||
|
||||
Reference in New Issue
Block a user