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]
fn new<T: Into<String>>(base: T) -> Self
[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
.
fn base_url<T: Into<String>>(self, base: T) -> Self
[src]
Set the base url for the Elasticsearch node.
fn url_param<T: ToString>(self, key: &'static str, value: T) -> Self
[src]
Set a url param value.
These parameters are added as query parameters to request urls.
fn header<H>(self, header: H) -> Self where
H: Header + Clone,
[src]
H: Header + Clone,
Set a request header.
fn get_base_url(&self) -> &str
[src]
Get the base url.
fn get_headers(&self) -> Headers
[src]
Create a new Headers
structure, and thread it through the configuration functions.
fn get_url_qry(&self) -> (usize, Option<String>)
[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]
fn clone(&self) -> RequestParams
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more