summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2023-10-11 15:00:53 +0200
committerBug Magnet <marco.nikic@mullvad.net>2023-10-12 13:55:07 +0200
commita2cfdb0456ba4ce8cf30868105d737a753b25483 (patch)
tree643c5cbbb414397fadd77d6017e52dbe2b5a12d6
parent558858d67633787df0f6ee52e5c177150ffdfcb7 (diff)
downloadmullvadvpn-a2cfdb0456ba4ce8cf30868105d737a753b25483.tar.xz
mullvadvpn-a2cfdb0456ba4ce8cf30868105d737a753b25483.zip
Add user agent header for all requests on iOS
-rw-r--r--ios/MullvadREST/HTTP.swift1
-rw-r--r--ios/MullvadREST/RESTRequestFactory.swift1
2 files changed, 2 insertions, 0 deletions
diff --git a/ios/MullvadREST/HTTP.swift b/ios/MullvadREST/HTTP.swift
index 900ab2a49a..93074fdbd3 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 00ed23e9ae..f0a3f3334e 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