Module http
Shared type definitions for the HTTP protocol.
http provides the common vocabulary types for HTTP
used across the Rust ecosystem.
hyper, axum, reqwest, and other HTTP libraries
all build on these types, making them interoperable.
This crate defines types only, with no I/O or protocol logic.
Request/Response- HTTP messages, generic over body typeMethod- HTTP methods (GET, POST, PUT, DELETE, etc.)StatusCode- HTTP status codes (200, 404, 500, etc.)Uri- request URIs with access to scheme, authority, path, and queryHeaderMap- efficient multi-map of header name-value pairsHeaderName/HeaderValue- typed header components
Examples
Building a request and inspecting its parts:
use ;
let req = builder
.method
.uri
.header
.body
.unwrap;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
let resp = builder
.status
.header
.body
.unwrap;
assert_eq!;
assert_eq!;