stdlib/http_clientView source ↗
http_client
14 items · generated by scribe fromstdlib/http_client.fd· synced 2026-11-15
Contents
- HttpResponse (struct)
- http_resp_header (function)
- http_request (function)
- http_get (function)
- http_post (function)
- http_head (function)
- http_get_url (function)
- http_put_url (function)
- http_post_url (function)
- http_body_type (function)
HttpResponse
A parsed HTTP response. status 0 = transport failure. header_names/header_vals are parallel vecs (original case).
pub struct HttpResponse {Fields:
| Name | Type |
|---|---|
status | i64 |
reason | str |
header_names | Vec<str> |
header_vals | Vec<str> |
body | str |
Defined at line 24
http_resp_header
Header value (case-insensitive name); "" when absent.
pub fn http_resp_header(r: HttpResponse, name: str) -> str {Parameters:
r:HttpResponsename:str
Returns: str
Defined at line 39
http_request
Issue an HTTP request. host may be a hostname (resolved via dns_lookup) or dotted IP. extra_headers may be "" or complete “K: v\r\nK2: v2\r\n” strings. body may be "". Returns HttpResponse with status 0 on transport failure.
pub fn http_request(method: str, host: str, port: i64, path: str, extra_headers: str, body: str) -> HttpResponse {Parameters:
method:strhost:strport:i64path:strextra_headers:strbody:str
Returns: HttpResponse
Defined at line 181
http_get
GET request; returns HttpResponse.
pub fn http_get(host: str, port: i64, path: str) -> HttpResponse {Parameters:
host:strport:i64path:str
Returns: HttpResponse
Defined at line 221
http_post
POST with body; content_type may be "" to omit the header.
pub fn http_post(host: str, port: i64, path: str, content_type: str, body: str) -> HttpResponse {Parameters:
host:strport:i64path:strcontent_type:strbody:str
Returns: HttpResponse
Defined at line 226
http_head
HEAD request (headers only).
pub fn http_head(host: str, port: i64, path: str) -> HttpResponse {Parameters:
host:strport:i64path:str
Returns: HttpResponse
Defined at line 235
http_get_url
GET a full http:// URL (https:// returns status 0 — no TLS).
pub fn http_get_url(u: str) -> HttpResponse {Parameters:
u:str
Returns: HttpResponse
Defined at line 242
http_put_url
PUT a full http:// URL with a raw (possibly binary) body.
pub fn http_put_url(u: str, body: str) -> HttpResponse {Parameters:
u:strbody:str
Returns: HttpResponse
Defined at line 263
http_post_url
POST a full http:// URL.
pub fn http_post_url(u: str, content_type: str, body: str) -> HttpResponse {Parameters:
u:strcontent_type:strbody:str
Returns: HttpResponse
Defined at line 284
http_body_type
Guess the body’s type from Content-Type or the path extension.
pub fn http_body_type(r: HttpResponse, path: str) -> str {Parameters:
r:HttpResponsepath:str
Returns: str
Defined at line 306
Generated by scribe, the Fides documentation generator