Skip to main content

send

Function send 

Source
pub fn send(req: &Request) -> Result<String, String>
Expand description

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).

Call from a background thread — this blocks on network I/O.

§Errors

Returns Err with the transport error message when the request cannot be completed (DNS, connection, TLS). An HTTP error status is not an error here: the formatted error response is returned as Ok.