Skip to content

Commit 23682ac

Browse files
committed
add responseHead to FileDownloadDelegate.Progress
1 parent b645ad4 commit 23682ac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/AsyncHTTPClient/FileDownloadDelegate.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ public final class FileDownloadDelegate: HTTPClientResponseDelegate {
2323
public struct Progress: Sendable {
2424
public var totalBytes: Int?
2525
public var receivedBytes: Int
26+
public var responseHead: HTTPResponseHead!
2627
}
2728

28-
private var progress = Progress(totalBytes: nil, receivedBytes: 0)
29+
private var progress = Progress(totalBytes: nil, receivedBytes: 0, responseHead: nil)
2930

3031
public typealias Response = Progress
3132

@@ -135,6 +136,8 @@ public final class FileDownloadDelegate: HTTPClientResponseDelegate {
135136
) -> EventLoopFuture<Void> {
136137
self.reportHead?(task, head)
137138

139+
self.progress.responseHead = head
140+
138141
if let totalBytesString = head.headers.first(name: "Content-Length"),
139142
let totalBytes = Int(totalBytesString)
140143
{

0 commit comments

Comments
 (0)