1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! # Rust SDK for Runtime.land.
//!
//! This SDK is used to develop Runtime.land functions.
//! It provides a set of methods to handle http request and response via `land_sdk::http` module on Runtime.land.
//!
//! # Hello World
//!
//! ```no_run
//! use land_sdk::http::{Body, Error, Request, Response};
//! use land_sdk::http_main;
//!
//! #[http_main]
//! pub fn handle_request(req: Request) -> Result<Response, Error> {
//! // read uri and method from request
//! let url = req.uri().clone();
//! let method = req.method().to_string().to_uppercase();
//!
//! // build response
//! Ok(http::Response::builder()
//! .status(200)
//! .header("X-Request-Url", url.to_string())
//! .header("X-Request-Method", method)
//! .body(Body::from("Hello Runtime.land!!"))
//! .unwrap())
//! }
//! ```
//!
// Make sure all our public APIs have docs.
/// Re-export macro from sdk-macro
pub use http_main;