Tool to mock api responses. Just register APIRequestMock in url session. ResourceNames
is an array of json
files with request responses in Bundle.main.
let configuration = URLSessionConfiguration.default
APIRequestMock.register(resourceNames: ["responses.json"], in: configuration)
Here is an example of resources.json
file:
"""
[
{
"enabled": true,
"uri": ["https://sampleurl.io/api/v1/items"],
"headers": {"api_token": "123"},
"comment": "Sample mocked response",
"value": [
{ "value": 1 },
{ "value": 2 },
{ "value": 3 },
]
}
]
"""
link |
Stars: 0 |
Last commit: 3 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics