Skip to main content

Crate vix_http_client

Crate vix_http_client 

Source
Expand description

A minimal HTTP client driven by a .http-style buffer, sent with the pure-Rust ureq client.

The buffer format (a common “REST client” shape):

POST https://api.example.com/things
Content-Type: application/json
Authorization: Bearer TOKEN

{"name": "widget"}

The first non-blank, non-comment line is METHOD url (the method is optional and defaults to GET); following lines up to a blank line are Header: value; everything after the blank line is the request body. Lines starting with # or // are comments. Parsing is pure and unit-tested; send performs the (blocking) request and is meant to be called from a background thread.

Structs§

Request
A parsed HTTP request.

Functions§

parse_request
Parse a .http-style buffer into a Request. Returns None if there is no request line with a URL.
send
Perform req (blocking) and format the response as text: a status line, the response headers, a blank line, then the body. On a transport error, returns Err with the message; on an HTTP error status (4xx/5xx), returns the formatted error response as Ok (it is still a real response to show).