pub struct RequestConfig {
pub url: StringSource,
pub method: Method,
pub headers: HashMap<String, StringSource>,
pub body: Option<RequestBody>,
pub response_handler: ResponseHandler,
pub client_config_diff: Option<HttpClientConfigDiff>,
}Expand description
Rules for making an HTTP request.
Currently only capable of making blocking requests.
Fields§
§url: StringSourceThe URL to send the request to.
Defaults to StringSource::Part(UrlPart::Whole).
method: MethodThe method to use.
Defaults to Method::GET.
headers: HashMap<String, StringSource>The headers to send in addition to the default headers from the HttpClientConfig and Self::client_config_diff.
If a call to StringSource::get returns None, the header it came from isn’t sent. This can be useful for API keys.
Defaults to an empty set.
body: Option<RequestBody>The body to send.
Defaults to None.
response_handler: ResponseHandlerWhat to part of the response to return.
Defaults to ResponseHandler::Body.
client_config_diff: Option<HttpClientConfigDiff>Overrides for the HttpClientConfig this uses to make the reqwest::blocking::Client.
Implementations§
Source§impl RequestConfig
impl RequestConfig
Sourcepub fn make(
&self,
task_state: &TaskStateView<'_>,
) -> Result<RequestBuilder, MakeHttpRequestError>
pub fn make( &self, task_state: &TaskStateView<'_>, ) -> Result<RequestBuilder, MakeHttpRequestError>
Makes the request.
§Errors
If the call to TaskStateView::http_client returns an error, that error is returned.
If Self::url’s call to StringSource::get returns an error, that error is returned.
If Self::url’s call to StringSource::get returns None, returns the error MakeHttpRequestError::StringSourceIsNone.
If any of Self::headers’s calls to StringSource::get return an error, that error is returned.
If any of Self::headers’s calls to HeaderName::try_from returns an error, that error is returned.
If the call to RequestBody::apply returns an error, that error is returned.
Sourcepub fn send(
&self,
task_state: &TaskStateView<'_>,
) -> Result<Response, SendHttpRequestError>
pub fn send( &self, task_state: &TaskStateView<'_>, ) -> Result<Response, SendHttpRequestError>
Makes and sends the request.
§Errors
If the call to Self::make returns an error, that error is returned.
If the call to reqwest::blocking::RequestBuilder::send returns an error, that error is returned.
Sourcepub fn response(
&self,
task_state: &TaskStateView<'_>,
) -> Result<String, HttpResponseError>
pub fn response( &self, task_state: &TaskStateView<'_>, ) -> Result<String, HttpResponseError>
Make the request, send it, and return the response specified by Self::response_handler.
§Errors
If the call to Self::send returns an error, that error is returned.
If the call to [RequestHandler::handle} returns an error, that error is returned.
Trait Implementations§
Source§impl Clone for RequestConfig
impl Clone for RequestConfig
Source§fn clone(&self) -> RequestConfig
fn clone(&self) -> RequestConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RequestConfig
impl Debug for RequestConfig
Source§impl Default for RequestConfig
impl Default for RequestConfig
Source§fn default() -> RequestConfig
fn default() -> RequestConfig
Source§impl<'de> Deserialize<'de> for RequestConfig
impl<'de> Deserialize<'de> for RequestConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RequestConfig
impl PartialEq for RequestConfig
Source§impl Serialize for RequestConfig
impl Serialize for RequestConfig
impl Eq for RequestConfig
impl StructuralPartialEq for RequestConfig
Auto Trait Implementations§
impl Freeze for RequestConfig
impl RefUnwindSafe for RequestConfig
impl Send for RequestConfig
impl Sync for RequestConfig
impl Unpin for RequestConfig
impl UnwindSafe for RequestConfig
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more