Swift3 headers (#5340)

* added headers to makeRequest function for swift3 template

* petstore update
This commit is contained in:
Ahmet Taha Sakar 2017-04-10 15:36:22 +01:00 committed by wing328
parent 19d5e74dbd
commit c6959b0d21
4 changed files with 12 additions and 12 deletions

View File

@ -45,8 +45,8 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the request
configuration (e.g. to override the cache policy).
*/
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding)
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers)
}
override open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: Error?) -> Void) {
@ -96,7 +96,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
}
})
} else {
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding)
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers)
if let onProgressReady = self.onProgressReady {
onProgressReady(request.progress)
}

View File

@ -45,8 +45,8 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the request
configuration (e.g. to override the cache policy).
*/
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding)
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers)
}
override open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: Error?) -> Void) {
@ -96,7 +96,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
}
})
} else {
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding)
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers)
if let onProgressReady = self.onProgressReady {
onProgressReady(request.progress)
}

View File

@ -45,8 +45,8 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the request
configuration (e.g. to override the cache policy).
*/
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding)
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers)
}
override open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: Error?) -> Void) {
@ -96,7 +96,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
}
})
} else {
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding)
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers)
if let onProgressReady = self.onProgressReady {
onProgressReady(request.progress)
}

View File

@ -45,8 +45,8 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
May be overridden by a subclass if you want to control the request
configuration (e.g. to override the cache policy).
*/
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding)
open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest {
return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers)
}
override open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: Error?) -> Void) {
@ -96,7 +96,7 @@ open class AlamofireRequestBuilder<T>: RequestBuilder<T> {
}
})
} else {
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding)
let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers)
if let onProgressReady = self.onProgressReady {
onProgressReady(request.progress)
}