Made the MockURLProtocol class available for non Apple platforms by importing the FoundationNetworking framework.

This commit is contained in:
Javier Cicchelli 2023-04-30 15:25:09 +02:00
parent fb439a82a8
commit 567d48aefa

View File

@ -10,9 +10,12 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
import Foundation import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
/// This class overrides the `URLProtocol` protocol used by the `URLSession` to handle the loading of protocol-specific URL data so it is possible to mock URL response for testing purposes. /// This class overrides the `URLProtocol` protocol used by the `URLSession` to handle the loading of protocol-specific URL data so it is possible to mock URL response for testing purposes.
public class MockURLProtocol: URLProtocol { public class MockURLProtocol: URLProtocol {
@ -117,4 +120,3 @@ public struct MockURLResponse {
} }
} }
#endif