From a2cfdb0456ba4ce8cf30868105d737a753b25483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Em=C4=ABls?= Date: Wed, 11 Oct 2023 15:00:53 +0200 Subject: [PATCH] Add user agent header for all requests on iOS --- ios/MullvadREST/HTTP.swift | 1 + ios/MullvadREST/RESTRequestFactory.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/ios/MullvadREST/HTTP.swift b/ios/MullvadREST/HTTP.swift index 900ab2a49aee..93074fdbd35a 100644 --- a/ios/MullvadREST/HTTP.swift +++ b/ios/MullvadREST/HTTP.swift @@ -47,4 +47,5 @@ enum HTTPHeader { static let contentType = "Content-Type" static let etag = "ETag" static let ifNoneMatch = "If-None-Match" + static let userAgent = "User-Agent" } diff --git a/ios/MullvadREST/RESTRequestFactory.swift b/ios/MullvadREST/RESTRequestFactory.swift index 00ed23e9aea2..f0a3f3334eb4 100644 --- a/ios/MullvadREST/RESTRequestFactory.swift +++ b/ios/MullvadREST/RESTRequestFactory.swift @@ -62,6 +62,7 @@ extension REST { request.httpShouldHandleCookies = false request.addValue(hostname, forHTTPHeaderField: HTTPHeader.host) request.addValue("application/json", forHTTPHeaderField: HTTPHeader.contentType) + request.addValue("mullvad-app", forHTTPHeaderField: HTTPHeader.userAgent) request.httpMethod = method.rawValue let prefixedPathTemplate = URLPathTemplate(stringLiteral: pathPrefix) + pathTemplate