Skip to main content

rl_lang/docs/entries/stdlib/http/
http_request.rs

1use crate::docs::entry::FnEntry;
2
3pub static HTTP_REQUEST: FnEntry = FnEntry {
4    signature: "http_request(method, url, body?, headers?)",
5    description: "generic HTTP request covering any verb (PUT/DELETE/PATCH/HEAD/etc.); `headers` is an array of (string, string) tuples",
6    example: r#"
7get std::http::http_request
8
9dec (int, string) resp = result_unwrap(http_request("DELETE", "https://example.com/api/1", null, [("Authorization", "Bearer xyz")]))"#,
10    expected_output: None,
11    returns: "Result[(int, string)]",
12    errors: Some("Err(string) on a transport failure - not on non-2xx status"),
13    see_also: &["http_get", "http_post"],
14    since: Some("v0.1.5"),
15};