Struct twilight_http::request::RequestBuilder [−][src]
pub struct RequestBuilder(_);
Expand description
Builder to create a customized request.
Examples
Create a request to create a message with a content of “test” in a channel with an ID of 1:
use twilight_http::{request::Request, routing::Route}; let body = br#"{ "content": "test" }"#.to_vec(); let request = Request::builder(Route::CreateMessage { channel_id: 1, }).body(body).build();
Implementations
Create a new request builder.
Consume the builder, returning the built request.
Set the contents of the body.
Set the multipart form.
#[must_use = "request has not been fully built"]pub fn headers(
self,
iter: impl Iterator<Item = (HeaderName, HeaderValue)>
) -> Self[src]
#[must_use = "request has not been fully built"]pub fn headers(
self,
iter: impl Iterator<Item = (HeaderName, HeaderValue)>
) -> Self[src]Set the headers to add.
Set the body, to be serialized as JSON.
Errors
Returns an ErrorType::Json error type if the value could not be
serialized as JSON.
Whether to use the client’s authorization token in the request, if one is set.
This is primarily useful for executing webhooks.
Auto Trait Implementations
impl RefUnwindSafe for RequestBuilderimpl Send for RequestBuilderimpl Sync for RequestBuilderimpl Unpin for RequestBuilderimpl UnwindSafe for RequestBuilder