File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,16 @@ extension URLRequest.ContentType: HTTPHeader {
3838 public var value : String { rawValue }
3939}
4040
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+
4151/// Model for HTTP headers
4252public protocol HTTPHeader {
4353 var key : String { get }
Original file line number Diff line number Diff line change 2828 }
2929
3030 /// Manages the output queue and returns the new value for reach iteration.
31- private func queue( ) throws -> MockOutput {
31+ open func queue( ) throws -> MockOutput {
3232 guard outputs. count > 0 else {
3333 throw Errors . noOutputQueued
3434 }
5050 /// this
5151 /// version of `start`.
5252 /// Delay and repeat are handled here.
53- public func start( _: URLRequest ) async -> Result < Data , Failure > {
53+ open func start( _: URLRequest ) async -> Result < Data , Failure > {
5454 let next : MockOutput
5555 do {
5656 next = try queue ( )
You can’t perform that action at this time.
0 commit comments