From ce6cee72e6f709ca25fa49099a64e93a08394808 Mon Sep 17 00:00:00 2001 From: Hocine Moukaideche Date: Tue, 16 Aug 2022 14:33:59 +0200 Subject: [PATCH] Add Accept header on fetch status document request --- Sources/LCP/License/License.swift | 2 +- Sources/LCP/License/LicenseValidation.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LCP/License/License.swift b/Sources/LCP/License/License.swift index b3ab9a1bf..f1cbb98d0 100644 --- a/Sources/LCP/License/License.swift +++ b/Sources/LCP/License/License.swift @@ -212,7 +212,7 @@ extension License: LCPLicense { .flatMap { // We fetch the Status Document again after the HTML interaction is done, in case it changed the // License. - self.httpClient.fetch(statusURL) + self.httpClient.fetch(HTTPRequest(url: statusURL, headers: ["Accept": MediaType.lcpStatusDocument.string])) .map { $0.body ?? Data() } .eraseToAnyError() } diff --git a/Sources/LCP/License/LicenseValidation.swift b/Sources/LCP/License/LicenseValidation.swift index 7ddf1ddef..8a74cfdae 100644 --- a/Sources/LCP/License/LicenseValidation.swift +++ b/Sources/LCP/License/LicenseValidation.swift @@ -304,7 +304,7 @@ extension LicenseValidation { private func fetchStatus(of license: LicenseDocument) throws { let url = try license.url(for: .status, preferredType: .lcpStatusDocument) // Short timeout to avoid blocking the License, since the LSD is optional. - httpClient.fetch(HTTPRequest(url: url, timeoutInterval: 5)) + httpClient.fetch(HTTPRequest(url: url, headers: ["Accept": MediaType.lcpStatusDocument.string], timeoutInterval: 5)) .map { .retrievedStatusData($0.body ?? Data()) } .eraseToAnyError() .resolve(raise)