pub struct HttpRequest {
pub url: String,
pub verb: HttpVerb,
pub body: Option<Value>,
}Expand description
Represents a generic HTTP request.
This struct is used internally by the transport layer to construct and send requests.
Fields§
§url: StringThe URL path of the API endpoint (e.g., “/api/chat”).
verb: HttpVerbThe HTTP verb (GET, POST, PUT, DELETE) for the request.
body: Option<Value>The optional request body, serialized as a JSON value.
Implementations§
Source§impl HttpRequest
impl HttpRequest
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
Creates a new HttpRequest with the specified URL path.
The default HTTP verb is HttpVerb::GET.
Sourcepub fn get(self) -> Self
pub fn get(self) -> Self
Sets the HTTP verb for the request to HttpVerb::GET.
Sourcepub fn post(self) -> Self
pub fn post(self) -> Self
Sets the HTTP verb for the request to HttpVerb::POST.
Sourcepub fn put(self) -> Self
pub fn put(self) -> Self
Sets the HTTP verb for the request to HttpVerb::PUT.
Sourcepub fn delete(self) -> Self
pub fn delete(self) -> Self
Sets the HTTP verb for the request to HttpVerb::DELETE.
Trait Implementations§
Source§impl Debug for HttpRequest
impl Debug for HttpRequest
Source§impl Default for HttpRequest
impl Default for HttpRequest
Source§fn default() -> HttpRequest
fn default() -> HttpRequest
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HttpRequest
impl RefUnwindSafe for HttpRequest
impl Send for HttpRequest
impl Sync for HttpRequest
impl Unpin for HttpRequest
impl UnsafeUnpin for HttpRequest
impl UnwindSafe for HttpRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more