macro_rules! http_post { ($url: expr, $data: expr, $headers: expr) => { ... }; ($url: expr, $data: expr) => { ... }; }
Expand description
Make a simple HTTP POST request
§Arguments
- url: The URL to POST
- data: The payload to POST
- headers: The headers to send with the request
§Examples
ⓘ
use pink::http_post;
let response = http_post!("https://example.com/", b"Hello, world!");
assert_eq!(response.status_code, 200);
ⓘ
use pink::http_post;
let headers = vec![("X-Foo".into(), "Bar".into())];
let response = http_post!("https://example.com/", b"Hello, world!", headers);
assert_eq!(response.status_code, 200);