File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,16 @@ extension URLRequest.ContentType: HTTPHeader {
38
38
public var value : String { rawValue }
39
39
}
40
40
41
+ extension Array where Element: HTTPHeader {
42
+ public var asDictionary : [ String : String ] {
43
+ var dict = [ String: String] ( )
44
+ dict. reserveCapacity ( count)
45
+ return reduce ( into: dict) { acc, next in
46
+ acc [ next. key] = next. value
47
+ }
48
+ }
49
+ }
50
+
41
51
/// Model for HTTP headers
42
52
public protocol HTTPHeader {
43
53
var key : String { get }
Original file line number Diff line number Diff line change 28
28
}
29
29
30
30
/// Manages the output queue and returns the new value for reach iteration.
31
- private func queue( ) throws -> MockOutput {
31
+ open func queue( ) throws -> MockOutput {
32
32
guard outputs. count > 0 else {
33
33
throw Errors . noOutputQueued
34
34
}
50
50
/// this
51
51
/// version of `start`.
52
52
/// Delay and repeat are handled here.
53
- public func start( _: URLRequest ) async -> Result < Data , Failure > {
53
+ open func start( _: URLRequest ) async -> Result < Data , Failure > {
54
54
let next : MockOutput
55
55
do {
56
56
next = try queue ( )
You can’t perform that action at this time.
0 commit comments