Struct elastic_reqwest::RequestParams [] [src]

pub struct RequestParams {
    pub base_url: String,
    pub url_params: BTreeMap<&'static str, String>,
    pub headers: Headers,
}

Misc parameters for any request.

The RequestParams struct allows you to set headers and url parameters for your requests. By default, the ContentType::json header will always be added. Url parameters are added as simple key-value pairs, and serialised by rust-url.

Examples

With default query parameters:

let params = RequestParams::default();

With a custom base url:

let params = RequestParams::new("http://mybaseurl:9200");

With custom headers:

let params = RequestParams::default()
    .header(Authorization("let me in".to_owned()));

With url query parameters:

let params = RequestParams::default()
    .url_param("pretty", true)
    .url_param("q", "*");

Fields

Base url for Elasticsearch.

Simple key-value store for url query params.

The complete set of headers that will be sent with the request.

Methods

impl RequestParams
[src]

Create a new container for request parameters.

This method takes a fully-qualified url for the Elasticsearch node. It will also set the Content-Type header to application/json.

Set the base url for the Elasticsearch node.

Set a url param value.

These parameters are added as query parameters to request urls.

Set a header value on the params.

Get the url query params as a formatted string.

Follows the application/x-www-form-urlencoded format. This method returns the length of the query string and an optional value. If the value is None, then the length will be 0.

Trait Implementations

impl Debug for RequestParams
[src]

Formats the value using the given formatter.

impl Clone for RequestParams
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for RequestParams
[src]

Returns the "default value" for a type. Read more