[][src]Struct exonum_testkit::RequestBuilder

pub struct RequestBuilder<'a, 'b, Q = ()> { /* fields omitted */ }

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]

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]

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]

pub async fn get<'_, R>(self, endpoint: &'_ str) -> Result<R> where
    R: DeserializeOwned + 'static, 
[src]

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]

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]

pub async fn post_pb<'_, R>(self, endpoint: &'_ str) -> Result<R> where
    R: DeserializeOwned + 'static, 
[src]

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]

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

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,