pub struct Http<Effect, Event> { /* private fields */ }
Implementations§
Source§impl<Effect, Event> Http<Effect, Event>
impl<Effect, Event> Http<Effect, Event>
Sourcepub fn get(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn get(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP GET request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::get("https://httpbin.org/get")
.expect_string()
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn head(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn head(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP HEAD request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::head("https://httpbin.org/get")
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn post(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn post(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP POST request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::post("https://httpbin.org/post")
.body_bytes(b"hello_world".to_owned())
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn put(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn put(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP PUT request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::put("https://httpbin.org/put")
.body_string("hello_world".to_string())
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn delete(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn delete(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP DELETE request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::delete("https://httpbin.org/delete")
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn patch(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn patch(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP PATCH request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::patch("https://httpbin.org/patch")
.body_form(&[("name", "Alice")]).unwrap()
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn options(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn options(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP OPTIONS request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::options("https://httpbin.org/get")
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn trace(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn trace(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP TRACE request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::trace("https://httpbin.org/get")
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn connect(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
pub fn connect(url: impl AsRef<str>) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform a HTTP CONNECT request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::connect("https://httpbin.org/get")
.build()
.then_send(Event::ReceiveResponse);
Sourcepub fn request(method: Method, url: Url) -> RequestBuilder<Effect, Event>
pub fn request(method: Method, url: Url) -> RequestBuilder<Effect, Event>
Instruct the Shell to perform an HTTP request to the provided url
.
The request can be configured via associated functions on the returned
RequestBuilder
and then converted to a [Command
]
with RequestBuilder::build
.
§Panics
This will panic if a malformed URL is passed.
§Examples
Http::request(Method::Post, "https://httpbin.org/post".parse().unwrap())
.body_form(&[("name", "Alice")]).unwrap()
.build()
.then_send(Event::ReceiveResponse);