Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux support #116

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/Mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

import Foundation
import XCTest
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// A Mock which can be used for mocking data requests with the `Mocker` by calling `Mocker.register(...)`.
public struct Mock: Equatable {
Expand Down
5 changes: 4 additions & 1 deletion Sources/Mocker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//

import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// Can be used for registering Mocked data, returned by the `MockingURLProtocol`.
public struct Mocker {
Expand Down Expand Up @@ -73,7 +76,7 @@ public struct Mocker {

private init() {
// Whenever someone is requesting the Mocker, we want the URL protocol to be activated.
URLProtocol.registerClass(MockingURLProtocol.self)
_ = URLProtocol.registerClass(MockingURLProtocol.self)
}

/// Register new Mocked data. If a mock for the same URL and HTTPMethod exists, it will be overwritten.
Expand Down
3 changes: 3 additions & 0 deletions Sources/MockingURLProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
//

import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

/// The protocol which can be used to send Mocked data back. Use the `Mocker` to register `Mock` data
open class MockingURLProtocol: URLProtocol {
Expand Down