From 401add5304950d0d1318294045dbf7c54a97bf44 Mon Sep 17 00:00:00 2001 From: Sjmarf <78750526+Sjmarf@users.noreply.github.com> Date: Sat, 20 Jan 2024 23:47:34 +0000 Subject: [PATCH] Remove unnecessary code --- Mlem/API/APIClient/APIClient.swift | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Mlem/API/APIClient/APIClient.swift b/Mlem/API/APIClient/APIClient.swift index 646494121..d9144a035 100644 --- a/Mlem/API/APIClient/APIClient.swift +++ b/Mlem/API/APIClient/APIClient.swift @@ -158,13 +158,11 @@ class APIClient { definition.headers.forEach { header in urlRequest.setValue(header.value, forHTTPHeaderField: header.key) } - - if !definition.headers.keys.contains("Authorization") { - if let overrideToken { - urlRequest.setValue("Bearer \(overrideToken)", forHTTPHeaderField: "Authorization") - } else if case let .authenticated(_, token) = session, try session.instanceUrl == definition.instanceURL { - urlRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") - } + + if let overrideToken { + urlRequest.setValue("Bearer \(overrideToken)", forHTTPHeaderField: "Authorization") + } else if case let .authenticated(_, token) = session, try session.instanceUrl == definition.instanceURL { + urlRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization") } if definition as? any APIGetRequest != nil {