File tree Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Expand file tree Collapse file tree 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 {
4646 return URL ( string: lastRequestURL)
4747 }
4848
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+
4962 @inlinable public init (
5063 version: HTTPVersion = . http1_1,
5164 status: HTTPResponseStatus = . ok,
@@ -66,7 +79,7 @@ public struct HTTPClientResponse: Sendable {
6679 status: HTTPResponseStatus ,
6780 headers: HTTPHeaders ,
6881 body: TransactionBody ,
69- history: [ HTTPClientRequestResponse ] = [ ]
82+ history: [ HTTPClientRequestResponse ]
7083 ) {
7184 self . init (
7285 version: version,
Original file line number Diff line number Diff line change @@ -242,7 +242,8 @@ extension Transaction: HTTPExecutableRequest {
242242 version: head. version,
243243 status: head. status,
244244 headers: head. headers,
245- body: body
245+ body: body,
246+ history: [ ]
246247 )
247248 continuation. resume ( returning: response)
248249 }
Original file line number Diff line number Diff line change @@ -405,6 +405,29 @@ extension HTTPClient {
405405 self . history = [ ]
406406 }
407407
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+
408431 /// Create HTTP `Response`.
409432 ///
410433 /// - parameters:
You can’t perform that action at this time.
0 commit comments