1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00

Add support for a HTTP body for POST (#139)

Closes https://github.com/emilk/egui/issues/137

Co-authored-by: Emil Ernerfeldt <emilernerfeldt@gmail.com>
This commit is contained in:
PauloMelo
2021-01-26 20:32:16 +00:00
committed by GitHub
parent 1ac1a72fa8
commit eedb63bb3b
3 changed files with 25 additions and 3 deletions

View File

@@ -263,6 +263,8 @@ pub mod http {
pub method: String,
/// https://…
pub url: String,
/// x-www-form-urlencoded body
pub body: String,
}
impl Request {
@@ -271,6 +273,16 @@ pub mod http {
Self {
method: "GET".to_owned(),
url: url.into(),
body: "".to_string(),
}
}
/// Create a `POST` requests with the give url and body.
pub fn post(url: impl Into<String>, body: impl Into<String>) -> Self {
Self {
method: "POST".to_owned(),
url: url.into(),
body: body.into(),
}
}
}