Skip to main content

ClientHandler

Trait ClientHandler 

Source
pub trait ClientHandler {
    // Required methods
    fn get_url(&self, url: &str) -> Response;
    fn post_json(&self, url: &str, json: &HashMap<&str, &str>) -> Response;
    fn post_body(&self, url: &str, body: &str) -> Response;
    fn put_xml(&self, url: &str, body: &str) -> Response;
    fn put_text(&self, url: &str, text: &str) -> Response;
}

Required Methods§

Source

fn get_url(&self, url: &str) -> Response

Source

fn post_json(&self, url: &str, json: &HashMap<&str, &str>) -> Response

Source

fn post_body(&self, url: &str, body: &str) -> Response

Source

fn put_xml(&self, url: &str, body: &str) -> Response

Source

fn put_text(&self, url: &str, text: &str) -> Response

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ClientHandler for Client

Source§

fn get_url(&self, url: &str) -> Response

Perform a GET request without parameter

§Args:

url - the suffix of the URL

Source§

fn post_json(&self, url: &str, json: &HashMap<&str, &str>) -> Response

Perform a POST request to send JSON and stores its result

§Args:

url - the suffix of the URL json - the json data to send

Source§

fn post_body(&self, url: &str, body: &str) -> Response

Perform a POST request to send a raw body and stores its result

§Args:

url - the suffix of the URL body - the body data to send (String format)

Source§

fn put_xml(&self, url: &str, body: &str) -> Response

Perform a PUT request to send a XML body and returns its result

§Args:

url - the suffix of the URL body - the body data to send (XML format)

Source§

fn put_text(&self, url: &str, text: &str) -> Response

Perform a PUT request to send a text body and returns its result

§Args:

url - the suffix of the URL text - the text to upload

Implementors§