HotSpring is just a package that provides an interface for HTTP requests.
HTTP clients are not implemented in HotSpring, but we implemented an HTTP client using Just as a sample. Therefore, you can use JustHTTPClient.
The following is a sample.
import HotSpring
import JustHTTPClient
enum SampleError: Error {
case invalidResponse
}
struct SampleRequest: Request {
let base = URL(string: "https://httpbin.org/get")!
let path = ""
let method = HTTPMethod.get
func decodeResponse(_ data: Any) throws -> Data {
guard let data = data as? Data else {
throw SampleError.invalidResponse
}
return data
}
}
let executor = Executor.Builder().addHTTPClient(JustHTTPClient()).build()
executor.execute(request) {
print($0.value, $0.error)
}
License
HotSpring is released under the MIT License. See the LICENSE file for more info.
HotSpring
A simple http client interface for Swift. HotSpring also works on Linux.
Requirements
Swift
macOS
Linux
Installation
Add the following to your dependencies in Package.swift.
Swift Package Manager v3
Swift Package Manager v4
Usage
HotSpring is just a package that provides an interface for HTTP requests. HTTP clients are not implemented in HotSpring, but we implemented an HTTP client using Just as a sample. Therefore, you can use JustHTTPClient.
The following is a sample.
License
HotSpring is released under the MIT License. See the LICENSE file for more info.