Skip to content

Commit

Permalink
Use the URLRequest containing the conditional GET info.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentsimmons committed Dec 1, 2024
1 parent b56a788 commit 80c78b6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions RSWeb/Sources/RSWeb/DownloadSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,15 @@ private extension DownloadSession {
return
}

var urlRequest = URLRequest(url: urlToUse)
if let conditionalGetInfo = delegate.downloadSession(self, conditionalGetInfoFor: url) {
conditionalGetInfo.addRequestHeadersToURLRequest(&urlRequest)
}
let urlRequest: URLRequest = {
var request = URLRequest(url: urlToUse)
if let conditionalGetInfo = delegate.downloadSession(self, conditionalGetInfoFor: url) {
conditionalGetInfo.addRequestHeadersToURLRequest(&request)
}
return request
}()

let task = urlSession.dataTask(with: urlToUse)
let task = urlSession.dataTask(with: urlRequest)

let info = DownloadInfo(url)
taskIdentifierToInfoDictionary[task.taskIdentifier] = info
Expand Down

0 comments on commit 80c78b6

Please sign in to comment.