You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: Sources/Mock.swift
+25-6
Original file line number
Diff line number
Diff line change
@@ -64,8 +64,22 @@ public struct Mock: Equatable {
64
64
/// The HTTP status code to return with the response.
65
65
publicletstatusCode:Int
66
66
67
-
/// The URL value generated based on the Mock data.
68
-
publicleturl:URL
67
+
/// The URL value generated based on the Mock data. Force unwrapped on purpose. If you access this URL while it's not set, this is a programming error.
68
+
publicvarurl:URL{
69
+
if urlToMock ==nil && !data.keys.contains(.get){
70
+
assertionFailure("For non GET mocks you should use the `request` property so the HTTP method is set.")
71
+
}
72
+
return urlToMock ?? generatedURL
73
+
}
74
+
75
+
/// The URL to mock as set implicitely from the init.
76
+
privateleturlToMock:URL?
77
+
78
+
/// The URL generated from all the data set on this mock.
79
+
privateletgeneratedURL:URL
80
+
81
+
/// The `URLRequest` to use if you did not set a specific URL.
82
+
publicletrequest:URLRequest
69
83
70
84
/// If `true`, checking the URL will ignore the query and match only for the scheme, host and path.
71
85
publicletignoreQuery:Bool
@@ -86,7 +100,12 @@ public struct Mock: Equatable {
0 commit comments