Skip to content

Commit 8088aa4

Browse files
committed
Oops! It's a bit difficult to implement a new Transport if you can't create a TransportResponse!
1 parent 644c532 commit 8088aa4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/StructuredAPIClient/Transport/Transport.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ public struct TransportResponse {
2626

2727
/// The raw HTTP response body. If there was no response body, this will have a zero length.
2828
public let body: Data
29+
30+
/// Create a new `TransportResponse`. Intended for use by `Transport` implementations.
31+
public init(status: HTTPStatusCode, headers: [String: String], body: Data) {
32+
self.status = status
33+
self.headers = headers
34+
self.body = body
35+
}
2936
}
3037

3138
/// A `Transport` maps a `URLRequest` to a `Status` and `Data` pair asynchronously.

0 commit comments

Comments
 (0)