http_wire
A Rust library to serialize HTTP/1.1 requests and responses to their wire format (raw bytes).
Note: This crate only supports HTTP/1.1. HTTP/2 is not supported due to its binary framing, HPACK header compression, and multiplexed nature which make single request/response serialization impractical.
Usage
Add to your Cargo.toml:
[]
= "0.1"
Using the ToWire trait
use ToWire;
use Request;
use Empty;
use Bytes;
async
Serializing responses
use ToWire;
use Response;
use Full;
use Bytes;
async
Error handling
use ;
async
WireError has three variants:
Connection- HTTP connection error (handshake or send failed)Sync- Internal synchronization errorUnsupportedVersion- HTTP version not supported (only HTTP/1.0 and HTTP/1.1 are supported)
License
MIT