grafbase_hooks/host_io/
http.rs1use crate::wit::HttpClient;
6pub use crate::wit::{HttpError, HttpMethod, HttpRequest, HttpResponse, HttpVersion};
7
8impl HttpMethod {
9 pub fn as_str(&self) -> &str {
11 match self {
12 HttpMethod::Get => "GET",
13 HttpMethod::Post => "POST",
14 HttpMethod::Put => "PUT",
15 HttpMethod::Delete => "DELETE",
16 HttpMethod::Patch => "PATCH",
17 HttpMethod::Head => "HEAD",
18 HttpMethod::Options => "OPTIONS",
19 HttpMethod::Trace => "TRACE",
20 HttpMethod::Connect => "CONNECT",
21 }
22 }
23}
24
25pub fn execute(request: &HttpRequest) -> Result<HttpResponse, HttpError> {
27 HttpClient::execute(request)
28}
29
30pub fn execute_many(requests: &[HttpRequest]) -> Vec<Result<HttpResponse, HttpError>> {
33 HttpClient::execute_many(requests)
34}