A simple and flexible HTTP client for Crystal with middleware support and built-in testing utilities.
Cossack is an HTTP client library for the Crystal programming language that provides a structured way to make HTTP requests with support for middleware, connection swapping, and testing utilities. It solves the problem of building flexible and testable HTTP clients by offering a modular architecture inspired by Ruby's Faraday.
Crystal developers who need a robust, extensible HTTP client for consuming APIs, building web services, or testing HTTP interactions in their applications.
Developers choose Cossack for its clean middleware system, built-in testing support with stubbable connections, and its design philosophy that prioritizes modularity and simplicity over monolithic solutions.
Simple and flexible HTTP client for Crystal with middleware and test support.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables custom request/response processing through middleware classes, similar to Ruby's Faraday, allowing for easy logging, caching, or redirection handling as shown in the README examples.
Includes TestConnection for stubbing HTTP requests in unit tests, making API testing straightforward without network calls, with real examples from projects like Glosbe.
Allows replacing the default HTTP connection with custom implementations for mocking or specialized behavior, useful for testing or adapting to unique environments.
Provides CookieJarMiddleware for persisting cookies between requests and exporting/importing them to files, enabling cross-session persistence as detailed in the FAQ.
The roadmap admits unimplemented features like basic authentication, forcing developers to build custom middleware or find workarounds for common needs.
For basic HTTP requests, the middleware system adds unnecessary overhead compared to Crystal's standard library, with a steeper learning curve for simple use cases.
While some middleware is provided, the ecosystem is less mature than libraries in other languages, offering fewer pre-built options for advanced functionality like rate limiting.