HTTP Functions

This chapter introduces the http macros provided by the Surreal ORM. The http macros are used for performing remote HTTP requests such as HEAD, GET, POST, PUT, and PATCH.

Table of Contents

http::head!()

The http::head!() macro performs a remote HTTP HEAD request. It has the following syntax:

#![allow(unused)]
fn main() {
http::head!("https://codebreather.com");
}

The http::head!() macro generates the following function call:

http::head("https://codebreather.com", None as Option<ObjectLike>)

http::get!()

The http::get!() macro performs a remote HTTP GET request. It has the following syntax:

#![allow(unused)]
fn main() {
http::get!("https://codebreather.com");
}

The http::get!() macro generates the following function call:

http::get("https://codebreather.com", None as Option<ObjectLike>)

http::delete!()

The http::delete!() macro performs a remote HTTP DELETE request. It has the following syntax:

#![allow(unused)]
fn main() {
http::delete!("https://codebreather.com");
}

The http::delete!() macro generates the following function call:

http::delete("https://codebreather.com", None as Option<ObjectLike>)

http::post!()

The http::post!() macro performs a remote HTTP POST request. It has the following syntax:

#![allow(unused)]
fn main() {
http::post!("https://codebreather.com", body);
}

The http::post!() macro generates the following function call:

http::post("https://codebreather.com", body, None as Option<ObjectLike>)

http::put!()

The http::put!() macro performs a remote HTTP PUT request. It has the following syntax:

#![allow(unused)]
fn main() {
http::put!("https://codebreather.com", body);
}

The http::put!() macro generates the following function call:

http::put("https://codebreather.com", body, None as Option<ObjectLike>)

http::patch!()

The http::patch!() macro performs a remote HTTP PATCH request. It has the following syntax:

#![allow(unused)]
fn main() {
http::patch!("https://codebreather.com", body);
}

The http::patch!() macro generates the following function call:

http::patch("https://codebreather.com", body, None as Option<ObjectLike>)