A Crystal HTTP client with a chainable REST API, built-in sessions, and middleware support.
Halite is an HTTP client library for the Crystal programming language that provides a chainable REST API, built-in sessions, and a middleware system. It simplifies making HTTP requests with features like automatic redirect handling, flexible data serialization, and extensible logging, addressing the need for a robust, developer-friendly HTTP client in Crystal's ecosystem.
Crystal developers building applications that interact with web APIs, microservices, or external HTTP-based services, especially those needing advanced features like persistent sessions, middleware interception, or streaming responses.
Developers choose Halite for its expressive chainable API, comprehensive feature set inspired by popular libraries like Ruby's HTTP.rb and Python's requests, and seamless integration with Crystal's type system and performance characteristics.
💎HTTP Requests Client with a chainable REST API, built-in sessions and middlewares.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides a fluent interface inspired by Ruby's HTTP.rb and Python's requests, with methods like .headers() and .timeout() for intuitive request building, as demonstrated in the README's extensive examples.
Persistent sessions automatically maintain cookies and headers across requests, simplifying stateful API interactions, similar to Python's requests.Session.
Allows custom features like logging, caching, and interceptors through a flexible model, enabling advanced request/response manipulation without modifying core logic.
Supports query parameters, form data, JSON payloads, file uploads, and raw strings, with built-in parsers for JSON and extensible MIME type adapters for formats like YAML.
Raises specific exceptions for timeouts, redirect limits, and HTTP error status codes, aiding in debugging and improving reliability in production environments.
Limited to Crystal's relatively niche community, resulting in fewer third-party middleware options and slower adoption of new features compared to HTTP clients in more popular languages.
The feature-rich design, including middleware chains and session persistence, can add latency for simple requests, making it less ideal for ultra-high-performance scenarios where minimal overhead is critical.
Writing custom middleware requires understanding Halite's feature system and interceptor chain, which may have a steeper learning curve and increased boilerplate code for developers new to the library.
The README does not mention support for modern protocols like HTTP/2 or WebSockets, limiting its use in applications requiring these cutting-edge technologies without additional workarounds.