1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! # 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.
pub use Body;
pub use ;
pub use FromRequest;
pub use ;
pub use ;
pub use ;
// Re-exported so downstream crates and applications reference one `http`
// version rather than accidentally depending on a second copy.
pub use http;
pub use ;