Swiftpack.co - ceperai/APIRequestMock as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ceperai.
ceperai/APIRequestMock 1.0.0
Allows to mock requests.
⭐️ 0
🕓 3 years ago
iOS tvOS
.package(url: "https://github.com/ceperai/APIRequestMock.git", from: "1.0.0")

APIRequestMock

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 },
        ]
    }
]
"""

GitHub

link
Stars: 0
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics