Skip to content
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

Merged
merged 6 commits into from
Apr 18, 2018
Merged

Fix user-agent #279

merged 6 commits into from
Apr 18, 2018

Conversation

kvld
Copy link
Contributor

@kvld kvld commented Apr 17, 2018

Задача: #APPS-1862

Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Зафиксировали юзер-агент для всех сетевых запросов

Описание:
Описание формата юзер-агента в задаче в ютреке. Добавлен класс AlamofireDefaultSessionManager, для которого задается юзер-агент и который следует использовать вместо вызова глобальных функций из Alamofire.

@kvld kvld self-assigned this Apr 17, 2018
@kvld kvld requested a review from Ostrenkiy April 17, 2018 09:17
@kvld kvld added this to the 1.57 milestone Apr 17, 2018
@@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Кажется, RequestChain нигде не используется и это можно выпилить вообще

@@ -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({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь надо заменить на просто manager

@@ -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({
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

думаю, будет лучше, если заменить на var
(но это по желанию - как самому больше нравится)

@kvld
Copy link
Contributor Author

kvld commented Apr 17, 2018

@Ostrenkiy смотри.

@Ostrenkiy Ostrenkiy merged commit bfe3573 into dev Apr 18, 2018
@Ostrenkiy Ostrenkiy deleted the fix/user-agent branch April 18, 2018 08:45
@kvld kvld mentioned this pull request Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants