File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -174,9 +174,21 @@ networking.set(mockData: [
174
174
),
175
175
statusCode : 200 , // Int: If omitted, 200 is used
176
176
error : nil
177
+ ),
178
+ " /only/an/path" : .init (
179
+ data : " OVERRIDE" , // Can be Data or String
180
+ response : .init ( // NSURLResponse, Can be nil
181
+ url : .init (stringLiteral : " https://wesleydegroot.nl/only/an/path" ),
182
+ mimeType : " text/html" ,
183
+ expectedContentLength : 8 ,
184
+ textEncodingName : " utf-8"
185
+ ),
186
+ statusCode : 200 , // Int: If omitted, 200 is used
187
+ error : nil
177
188
)
178
189
])
179
190
```
191
+
180
192
### Debugging
181
193
``` swift
182
194
Original file line number Diff line number Diff line change @@ -93,7 +93,15 @@ open class SimpleNetworking {
93
93
/// Set mock url data
94
94
/// - Parameter mock: Mock request.
95
95
public func set( mockData: [ String : SNMock ] ) {
96
- self . mockData = mockData
96
+ var newMockData : [ String : SNMock ] = [ : ]
97
+
98
+ for (url, mock) in mockData {
99
+ if let validURL = isURL ( url) {
100
+ newMockData [ validURL. absoluteString] = mock
101
+ }
102
+ }
103
+
104
+ self . mockData = newMockData
97
105
}
98
106
99
107
/// Add a cookie to the storage
You can’t perform that action at this time.
0 commit comments