File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ final class MockBundle {
6363 return false
6464 }
6565
66+ /// Takes a URL and attempts to parse the file at that location into a MockRequestResponse
67+ /// If the file doesn't exist, or isn't in the expected MockDuck format, nil is returned
68+ ///
69+ /// - Parameter targetURL: URL that should be loaded from file
70+ /// - Returns: MockRequestResponse if the request exists at that URL
6671 func loadResponseFile( targetURL: URL ? ) -> MockRequestResponse ? {
6772 guard let targetURL = targetURL else { return nil }
6873 let decoder = JSONDecoder ( )
@@ -86,6 +91,11 @@ final class MockBundle {
8691 return nil
8792 }
8893
94+ /// Takes a passed in hostname and returns all the recorded mocks for that URL.
95+ /// If an empty string is passed in, all recordings will be returned.
96+ ///
97+ /// - Parameter hostname: String representing the hostname to load requests from.
98+ /// - Returns: An array of MockRequestResponse for each request under that domain
8999 func getResponses( for hostname: String ) -> [ MockRequestResponse ] {
90100 guard let baseURL = recordingURL else { return [ ] }
91101
Original file line number Diff line number Diff line change @@ -138,6 +138,11 @@ public final class MockDuck {
138138
139139 // MARK: - Fetching Response Objects
140140
141+ /// Takes a passed in hostname and returns all the recorded mocks for that URL.
142+ /// If an empty string is passed in, all recordings will be returned.
143+ ///
144+ /// - Parameter hostname: String representing the hostname to load requests from.
145+ /// - Returns: An array of MockRequestResponse for each request under that domain
141146 public static func getResponses( for hostname: String ) -> [ MockRequestResponse ] {
142147 checkConfigureMockDuck ( )
143148 return mockBundle. getResponses ( for: hostname)
You can’t perform that action at this time.
0 commit comments