[−][src]Struct exonum_testkit::RequestBuilder
An HTTP requests builder. This type can be used to send requests to
the appropriate TestKitApi
handlers.
Methods
impl<'a, 'b, Q> RequestBuilder<'a, 'b, Q> where
Q: 'b,
[src]
Q: 'b,
pub fn query<T>(self, query: &'b T) -> RequestBuilder<'a, 'b, T>
[src]
Sets a request data of the current request.
For GET
requests, it will be serialized as a query string parameters,
and for POST
requests, it will be serialized as a JSON in the request body.
pub fn with<F>(self, f: F) -> Self where
F: FnOnce(ReqwestBuilder) -> ReqwestBuilder + Send + 'b,
[src]
F: FnOnce(ReqwestBuilder) -> ReqwestBuilder + Send + 'b,
Allows to modify a request before sending it by executing a provided closure.
pub fn expect_header(self, header: &str, value: &str) -> Self
[src]
Allows to check that response will contain a specific header.
impl<'_, '_, Q> RequestBuilder<'_, '_, Q> where
Q: Serialize,
[src]
Q: Serialize,
pub async fn get<'_, R>(self, endpoint: &'_ str) -> Result<R> where
R: DeserializeOwned + 'static,
[src]
R: DeserializeOwned + 'static,
Sends a GET request to the testing API endpoint and decodes response as the corresponding type.
If query was specified, it is serialized as a query string parameters.
pub async fn post<'_, R>(self, endpoint: &'_ str) -> Result<R> where
R: DeserializeOwned + 'static,
[src]
R: DeserializeOwned + 'static,
Sends a POST request to the testing API endpoint and decodes response as the corresponding type.
If query was specified, it is serialized as a JSON in the request body.
impl<'_, '_, Q> RequestBuilder<'_, '_, Q> where
Q: ProtobufConvert,
Q::ProtoStruct: Message,
[src]
Q: ProtobufConvert,
Q::ProtoStruct: Message,
pub async fn post_pb<'_, R>(self, endpoint: &'_ str) -> Result<R> where
R: DeserializeOwned + 'static,
[src]
R: DeserializeOwned + 'static,
Sends a Protobuf-encoded POST request to the testing API endpoint and decodes response as the corresponding type.
The query is serialized as Protobuf using Content-Type: application/octet-stream
.
If the query was not specified, an empty buffer is used.
Trait Implementations
impl<'a, 'b, Q> Debug for RequestBuilder<'a, 'b, Q> where
Q: 'b + Debug,
[src]
Q: 'b + Debug,
Auto Trait Implementations
impl<'a, 'b, Q = ()> !RefUnwindSafe for RequestBuilder<'a, 'b, Q>
impl<'a, 'b, Q> Send for RequestBuilder<'a, 'b, Q> where
Q: Sync,
Q: Sync,
impl<'a, 'b, Q = ()> !Sync for RequestBuilder<'a, 'b, Q>
impl<'a, 'b, Q> Unpin for RequestBuilder<'a, 'b, Q>
impl<'a, 'b, Q = ()> !UnwindSafe for RequestBuilder<'a, 'b, Q>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,