fix: send auth token with sentence boundary API requests
This commit is contained in:
@@ -25,14 +25,17 @@ enum HTTPClient {
|
||||
_ type: T.Type,
|
||||
baseURL: String,
|
||||
path: String,
|
||||
timeout: TimeInterval
|
||||
timeout: TimeInterval,
|
||||
additionalHeaders: [String: String] = [:]
|
||||
) async throws -> (value: T, effectiveBaseURL: String) {
|
||||
var headers = ["Accept": "application/json"]
|
||||
headers.merge(additionalHeaders) { _, new in new }
|
||||
let result = try await execute(
|
||||
baseURL: baseURL,
|
||||
path: path,
|
||||
method: "GET",
|
||||
timeout: timeout,
|
||||
headers: ["Accept": "application/json"]
|
||||
headers: headers
|
||||
)
|
||||
guard (200...299).contains(result.statusCode) else {
|
||||
let body = String(data: result.body, encoding: .utf8) ?? ""
|
||||
|
||||
Reference in New Issue
Block a user