-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from finestructure/load-testing
Load testing
- Loading branch information
Showing
55 changed files
with
2,257 additions
and
1,046 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Data-ext.swift | ||
// ResterCore | ||
// | ||
// Created by Sven A. Schmidt on 14/04/2019. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
extension Data { | ||
var json: Value? { | ||
if let data = try? JSONDecoder().decode([Key: Value].self, from: self) { | ||
return .dictionary(data) | ||
} else if let data = try? JSONDecoder().decode([Value].self, from: self) { | ||
return .array(data) | ||
} else { | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// Double+ext.swift | ||
// ResterCore | ||
// | ||
// Created by Sven A. Schmidt on 12/04/2019. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
extension Double { | ||
public var seconds: DispatchTimeInterval { | ||
return .nanoseconds(Int(self * 1e9)) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Sources/ResterCore/Extensions/KeyedDecodingContainer+ext.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// KeyedDecodingContainer+ext.swift | ||
// ResterCore | ||
// | ||
// Created by Sven A. Schmidt on 11/04/2019. | ||
// | ||
|
||
import Foundation | ||
|
||
|
||
extension KeyedDecodingContainer { | ||
func decodeRequests(for key: KeyedDecodingContainer.Key) throws -> [Request] { | ||
if contains(key) { | ||
do { | ||
let req = try decode(OrderedDict<Request.Name, Request.Details>.self, forKey: key) | ||
return req.items.compactMap { $0.first }.map { Request(name: $0.key, details: $0.value) } | ||
} catch let DecodingError.keyNotFound(key, _) { | ||
throw ResterError.keyNotFound(key.stringValue) | ||
} | ||
} else { | ||
return [] | ||
} | ||
} | ||
} |
Oops, something went wrong.