Struct elastic_reqwest::RequestParams [] [src]

pub struct RequestParams { /* fields omitted */ }

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", "*");

Methods

impl RequestParams
[src]

[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.

[src]

Set the base url for the Elasticsearch node.

[src]

Set a url param value.

These parameters are added as query parameters to request urls.

[src]

Set a request header.

[src]

Get the base url.

[src]

Create a new Headers structure, and thread it through the configuration functions.

[src]

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 Clone for RequestParams
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for RequestParams
[src]

[src]

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