Espresso Martini
is a vapor-powered mock server. It allows you you to mock HTTP requests easily, so you worry about the things that matter, and not have to wait on APIs to be live.
Just configure your request/response pairs, known as NetworkExchange
, run the server, and you are good to go. Requests made to the configured hostname and port will be intercepted and the server will return any desired response.
It supports different types of data, response headers and all HTTP response codes.
The library is fully tested and documented.
When running on iOS you will get a threading warning, which is a known issue with NIO and can be safely ignored.
networkExchange
basisOpen your Package.swift
file and add the following as your dependency.
dependencies: [
.package(url: "https://github.com/TheInkedEngineer/Espresso-Martini", from: "1.0.0")
]
Then add the following to your target's dependency:
targets: [
.target(
name: "MyTarget",
dependencies: [
.product(name: "https://github.com/TheInkedEngineer/Espresso-Martini", package: "Espresso-Martini")
]
)
]
+
buttonhttps://github.com/TheInkedEngineer/Espresso-Martini
url in the search bar and press EnterAdd Package
buttonThe code for Espresso-Martini
is fully documented. An DocC documentation will follow :).
import EMMockServer
SimpleConfigurationProvider
or creating your custom implementation of ServerConfigurationProvider
run()
try? server.configure(using: ServerConfiguration(networkExchanges: Demo.networkExchanges))
inside of main.swift
.Working on your first Pull Request? You can learn how from this free series How to Contribute to an Open Source Project on GitHub
link |
Stars: 12 |
Last commit: 1 week ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics