-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmethod.rs
More file actions
36 lines (25 loc) · 962 Bytes
/
Copy pathmethod.rs
File metadata and controls
36 lines (25 loc) · 962 Bytes
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
use feignhttp::{delete, get, patch, post, put};
#[get("https://httpbin.org/get")]
async fn get() -> feignhttp::Result<String> {}
#[post("https://httpbin.org/post")]
async fn post(#[body] data: &str) -> feignhttp::Result<String> {}
#[put("https://httpbin.org/put")]
async fn put(#[body] data: &str) -> feignhttp::Result<String> {}
#[delete("https://httpbin.org/delete")]
async fn delete() -> feignhttp::Result<String> {}
#[patch("https://httpbin.org/patch")]
async fn patch(#[body] data: &str) -> feignhttp::Result<String> {}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let r = get().await?;
println!("get result: {}", r);
let r = post("hello").await?;
println!("post result: {}", r);
let r = put("hello").await?;
println!("put result: {}", r);
let r = delete().await?;
println!("delete result: {}", r);
let r = patch("hello").await?;
println!("patch result: {}", r);
Ok(())
}