Skip to content

Commit 884063c

Browse files
LCP: Add Accept header on status document fetch requests (#233)
1 parent 63a6ee7 commit 884063c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Sources/LCP/License/License.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ extension License: LCPLicense {
212212
.flatMap {
213213
// We fetch the Status Document again after the HTML interaction is done, in case it changed the
214214
// License.
215-
self.httpClient.fetch(statusURL)
215+
self.httpClient.fetch(HTTPRequest(url: statusURL, headers: ["Accept": MediaType.lcpStatusDocument.string]))
216216
.map { $0.body ?? Data() }
217217
.eraseToAnyError()
218218
}

Sources/LCP/License/LicenseValidation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ extension LicenseValidation {
304304
private func fetchStatus(of license: LicenseDocument) throws {
305305
let url = try license.url(for: .status, preferredType: .lcpStatusDocument)
306306
// Short timeout to avoid blocking the License, since the LSD is optional.
307-
httpClient.fetch(HTTPRequest(url: url, timeoutInterval: 5))
307+
httpClient.fetch(HTTPRequest(url: url, headers: ["Accept": MediaType.lcpStatusDocument.string], timeoutInterval: 5))
308308
.map { .retrievedStatusData($0.body ?? Data()) }
309309
.eraseToAnyError()
310310
.resolve(raise)

0 commit comments

Comments
 (0)