🆕 Changelog (Version 0.2.0)
- Nouvelle fonctionnalité : Gestion des cookies
Ajout de helpers pour inclure des cookies directement dans les réponses
ok_with_cookie: Générer une réponse OK avec un cookie attaché.
bad_request_with_cookie: Générer une réponse Bad Request avec un cookie attaché.
- Nouvelle fonctionnalité : Headers dynamiques
Ajout de helpers pour ajouter dynamiquement des headers personnalisés dans les réponses
ok_with_headers: Générer une réponse OK avec des headers personnalisés.
bad_request_with_headers: Générer une réponse Bad Request avec des headers personnalisés.
- Amélioration du Middleware :
Le middleware ajoute maintenant
x-status-description : Une description associée au code de statut HTTP.
x-response-time-ms : La durée de traitement de la requête en millisecondes.
📚 Documentation et Exemples Complets
Des exemples complets, y compris des cas d'utilisation détaillés et des intégrations avancées, sont disponibles dans le repository GitHub du projet (https://github.com/simbld/simbld-http/tree/main/examples).
Exemples inclus
-
Basic Usage : Une introduction à l'utilisation de simbld-http.
-
Middleware Integration : Démonstration de l'intégration dans un serveur Actix Web avec un middleware personnalisé.
-
Response Helpers : Utilisation des helpers pour créer des réponses avec cookies ou headers personnalisés.
🌟 Simbld-HTTP (v0.1.0)
Simbld-HTTP is a modular and comprehensive Rust library designed for managing HTTP response codes. Whether you're building APIs, handling custom response codes, or integrating middleware, Simbld-HTTP provides an organized and extensible framework to simplify your workflow.
✨ Key Features
Support for Standard and Custom HTTP Codes:
Handles all standard HTTP response families: 1xx to 5xx. Extends with custom families: 6xx, 7xx, and 9xx. Includes detailed descriptions for every status code.
Extensive Utilities:
JSON and XML response formatting. Helpers for paginated and generic HTTP responses. Middleware integration for Actix Web.
Easy Extensibility:
Add new families or custom helpers with minimal effort.
🚀 Why Choose Simbld-HTTP?
Developer-Friendly: Intuitive API with detailed documentation. Modular Design: Use only the parts you need for your project. Future-Proof: Easily extend to accommodate evolving HTTP standards and custom needs. Battle-Tested: Includes robust tests to ensure reliability.
📦 Installation
Add Simbld-HTTP to your ``Cargo.toml:
[]
= "0.2.0"
📚 Documentation
Local Documentation
Run the following command to generate and open the documentation:
This will
- Generate detailed API documentation from inline comments (///).
- Display all public modules, enums, and methods.
Online Documentation
The full documentation will be available on docs.rs after publishing. Stay tuned for updates!
🔧 Usage Examples
Basic Usage
;
)));
Retrieve a Crawler Code
;
;
) {
Run the example with
Using the Middleware
Test the middleware response with curl
⚙️ Structure of Families
| Family | Description |
|---|---|
| 1xx | Informational responses (e.g., Continue, Processing) |
| 2xx | Successful responses (e.g., OK, Created) |
| 3xx | Redirection responses (e.g., Moved Permanently, Temporary Redirect) |
| 4xx | Client errors (e.g., Bad Request, Unauthorized) |
| 5xx | Server errors (e.g., Internal Server Error, Service Unavailable) |
| 6xx | Service operations (e.g., Service Timeout) |
| 7xx | Crawler responses (e.g., Rate Limited, Crawl Blocked) |
| 9xx | Local API errors (e.g., InsufficientFunds, ExpiredCard) |
🤝 Contributing to Simbld-HTTP
We welcome contributions to Simbld-HTTP! Help us make this library the go-to solution for HTTP response code management in Rust.
1 Fork this repository
2 Clone your fork
3 Create a branch for your changes
4 Test your changes
5 Open a pull request
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.