-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix user-agent #279
Fix user-agent #279
Conversation
Stepic/RequestChain.swift
Outdated
@@ -25,7 +25,7 @@ class RequestChain { | |||
|
|||
func start(_ completionHandler: @escaping CompletionHandler) { | |||
if let request = requests.first { | |||
Alamofire.request(request as! URLRequestConvertible).response { | |||
AlamofireDefaultSessionManager.shared.request(request as! URLRequestConvertible).response { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется, RequestChain нигде не используется и это можно выпилить вообще
Stepic/QueriesAPI.swift
Outdated
@@ -19,7 +19,7 @@ class QueriesAPI: APIEndpoint { | |||
|
|||
let params: Parameters = ["query": query] | |||
|
|||
return Alamofire.request("\(StepicApplicationsInfo.apiURL)/\(name)", parameters: params, headers: headers).responseSwiftyJSON({ | |||
return AlamofireDefaultSessionManager.shared.request("\(StepicApplicationsInfo.apiURL)/\(name)", parameters: params, headers: headers).responseSwiftyJSON({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь надо заменить на просто manager
Stepic/EnrollmentsAPI.swift
Outdated
@@ -39,7 +39,7 @@ class EnrollmentsAPI: APIEndpoint { | |||
] | |||
|
|||
if !delete { | |||
return Alamofire.request("\(StepicApplicationsInfo.apiURL)/\(name)", method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseSwiftyJSON({ | |||
return AlamofireDefaultSessionManager.shared.request("\(StepicApplicationsInfo.apiURL)/\(name)", method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).responseSwiftyJSON({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно заменить на manager.
здесь и везде, где наследуется от ApiEndpoint
import Foundation | ||
|
||
class StepikURLSessionConfiguration: URLSessionConfiguration { | ||
private static func buildUserAgent() -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
думаю, будет лучше, если заменить на var
(но это по желанию - как самому больше нравится)
@Ostrenkiy смотри. |
Задача: #APPS-1862
Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Зафиксировали юзер-агент для всех сетевых запросов
Описание:
Описание формата юзер-агента в задаче в ютреке. Добавлен класс
AlamofireDefaultSessionManager
, для которого задается юзер-агент и который следует использовать вместо вызова глобальных функций из Alamofire.