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:
@@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user