rainier-http 1.0.0

HTTP requests, responses, cookies, uploads and extractors for the Rainier framework.
Documentation
rainier-http-1.0.0 has been yanked.

rainier-http

The HTTP message layer: [Request], [Response], [Body], [Cookie], uploads, and the [FromRequest] extractors controller actions are written against.

It knows nothing about routing, middleware or the server — those are layered on top. That is what lets a test drive a controller with a hand-built [Request] and assert on the [Response], with no runtime and no socket:

use rainier_http::{IntoResponse, Request, Response};
use http::{Method, StatusCode};

async fn show(request: &Request) -> Response {
    match request.input("id") {
        Some(id) => Response::json(&serde_json::json!({ "id": id })),
        None => Response::new(StatusCode::BAD_REQUEST),
    }
}

# #[tokio::main] async fn main() {
let request = Request::builder().method(Method::GET).uri("/posts?id=7").build();
assert_eq!(show(&request).await.status(), StatusCode::OK);
# }

The buffered-request decision

Request bodies arrive fully buffered, so request.input("title") is a plain synchronous call exactly as $request->input('title') is in Laravel. Response bodies may stream. See [body] for why the asymmetry is deliberate rather than an omission.