pub struct HttpRequest {
pub url: Url,
pub method: Method,
pub headers: Vec<Header>,
pub body: Option<String>,
pub assert_status: Vec<i32>,
}Expand description
The processor configuration.
Fields§
§url: UrlThe URL to make the request to.
method: MethodThe HTTP method (GET, POST, etc.) to use.
headers: Vec<Header>An optional set of headers to add to the request.
body: Option<String>The optional body of the request.
assert_status: Vec<i32>An assertion to validate the status code of the response matches one of the provided values.
Trait Implementations§
Source§impl Clone for HttpRequest
impl Clone for HttpRequest
Source§fn clone(&self) -> HttpRequest
fn clone(&self) -> HttpRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpRequest
impl Debug for HttpRequest
Source§impl<'de> Deserialize<'de> for HttpRequest
impl<'de> Deserialize<'de> for HttpRequest
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 HttpRequest
impl PartialEq for HttpRequest
Source§impl<'a> Processor<'a> for HttpRequest
impl<'a> Processor<'a> for HttpRequest
Source§fn validate(&self) -> Result<(), Self::Error>
fn validate(&self) -> Result<(), Self::Error>
Validate the HttpRequest configuration.
§Errors
This method returns an error if one of the provided HTTP headers has an invalid format.
Source§fn run(&self, _context: &Context) -> Result<Option<Self::Output>, Self::Error>
fn run(&self, _context: &Context) -> Result<Option<Self::Output>, Self::Error>
Do the configured HTTP request, and return its results.
§Output
If the request was successful, and the response status matches the optional status assertion, the body of the response is returned.
If the body is an empty string, None is returned instead.
§Errors
If the provided HTTP headers are invalid, the Error::Header error
variant is returned.
If the request fails, or the response body cannot be read, the
Error::Response error variant is returned.
If the response status does not match one of the provided status
assertions, the Error::Status error variant is returned.
Source§const NAME: &'static str = "HTTP Request"
const NAME: &'static str = "HTTP Request"
Source§impl Serialize for HttpRequest
impl Serialize for HttpRequest
impl Eq for HttpRequest
impl StructuralPartialEq for HttpRequest
Auto Trait Implementations§
impl Freeze for HttpRequest
impl RefUnwindSafe for HttpRequest
impl Send for HttpRequest
impl Sync for HttpRequest
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more