File tree 3 files changed +39
-2
lines changed
3 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,19 @@ public struct HTTPClientResponse: Sendable {
46
46
return URL ( string: lastRequestURL)
47
47
}
48
48
49
+ @inlinable public init (
50
+ version: HTTPVersion = . http1_1,
51
+ status: HTTPResponseStatus = . ok,
52
+ headers: HTTPHeaders = [ : ] ,
53
+ body: Body = Body ( )
54
+ ) {
55
+ self . version = version
56
+ self . status = status
57
+ self . headers = headers
58
+ self . body = body
59
+ self . history = [ ]
60
+ }
61
+
49
62
@inlinable public init (
50
63
version: HTTPVersion = . http1_1,
51
64
status: HTTPResponseStatus = . ok,
@@ -66,7 +79,7 @@ public struct HTTPClientResponse: Sendable {
66
79
status: HTTPResponseStatus ,
67
80
headers: HTTPHeaders ,
68
81
body: TransactionBody ,
69
- history: [ HTTPClientRequestResponse ] = [ ]
82
+ history: [ HTTPClientRequestResponse ]
70
83
) {
71
84
self . init (
72
85
version: version,
Original file line number Diff line number Diff line change @@ -242,7 +242,8 @@ extension Transaction: HTTPExecutableRequest {
242
242
version: head. version,
243
243
status: head. status,
244
244
headers: head. headers,
245
- body: body
245
+ body: body,
246
+ history: [ ]
246
247
)
247
248
continuation. resume ( returning: response)
248
249
}
Original file line number Diff line number Diff line change @@ -405,6 +405,29 @@ extension HTTPClient {
405
405
self . history = [ ]
406
406
}
407
407
408
+ /// Create HTTP `Response`.
409
+ ///
410
+ /// - parameters:
411
+ /// - host: Remote host of the request.
412
+ /// - status: Response HTTP status.
413
+ /// - version: Response HTTP version.
414
+ /// - headers: Reponse HTTP headers.
415
+ /// - body: Response body.
416
+ public init (
417
+ host: String ,
418
+ status: HTTPResponseStatus ,
419
+ version: HTTPVersion ,
420
+ headers: HTTPHeaders ,
421
+ body: ByteBuffer ?
422
+ ) {
423
+ self . host = host
424
+ self . status = status
425
+ self . version = version
426
+ self . headers = headers
427
+ self . body = body
428
+ self . history = [ ]
429
+ }
430
+
408
431
/// Create HTTP `Response`.
409
432
///
410
433
/// - parameters:
You can’t perform that action at this time.
0 commit comments