pub fn new_with_http(
        endpoint: &str,
        headers_opt: Option<HashMap<&str, &str>>,
    ) -> Result<Client<RequestCtx>, Error> {
        trace!("Client::new_with_http called -- endpoint: {}", endpoint);

        let mut header_map = HeaderMap::new();
        if let Some(headers) = headers_opt {
            for (key, value) in headers {
                let header_name = HeaderName::from_str(key)
                    .map_err(|e| Error::InvalidHeaderName { source: e })?;
                let header_value = HeaderValue::from_str(value)
                    .map_err(|e| Error::InvalidHeaderValue { source: e })?;
                header_map.insert(header_name, header_value);
            }
        }

        Ok(Client::<RequestCtx>::Http {
            endpoint: endpoint.to_string(),
            headers: header_map,
        })
    }
/// Takes the URL of a Warpgrapher service endpoint and returns a new ['Client'] initialized to
/// query that endpoint.  The type parameters are only relevant for a local instance of the
/// Warpgrapher engine, not for a remote HTTP client, so pass () for both type parameters, as
/// shown in the example below.
///
/// [`Client`]: ./enum.Client.html
///
///
/// # Examples
///
/// ```rust
/// # use warpgrapher::Client;
///
/// let mut client = Client::<()>::new_with_http("http://localhost:5000/graphql", None).unwrap();
/// ```
Takes the URL of a Warpgrapher service endpoint and returns a new ['Client'] initialized to
query that endpoint.  The type parameters are only relevant for a local instance of the
Warpgrapher engine, not for a remote HTTP client, so pass () for both type parameters, as
shown in the example below.


Takes the URL of a Warpgrapher service endpoint and returns a new [ ' Client ' ] initialized to query that endpoint . The type parameters are only relevant for a local instance of the Warpgrapher engine not for a remote HTTP client so pass () for both type parameters as shown in the example below .
pub fn new_with_http(
        endpoint: &str,
        headers_opt: Option<HashMap<&str, &str>>,
    ) -> Result<Client<RequestCtx>, Error> {
        trace!("Client::new_with_http called -- endpoint: {}", endpoint);
        let mut header_map = HeaderMap::new();
        if let Some(headers) = headers_opt {
            for (key, value) in headers {
                let header_name = HeaderName::from_str(key)
                    .map_err(|e| Error::InvalidHeaderName { source: e })?;
                let header_value = HeaderValue::from_str(value)
                    .map_err(|e| Error::InvalidHeaderValue { source: e })?;
                header_map.insert(header_name, header_value);
            }
        }
        Ok(Client::<RequestCtx>::Http {
            endpoint: endpoint.to_string(),
            headers: header_map,
        })
    }
pub fn new_with_http ( endpoint : & str , headers_opt : Option < HashMap < & str , & str > > , ) -> Result < Client < RequestCtx > , Error > { trace ! ( " " endpoint ) ; let mut header_map = HeaderMap :: new ( ) ; if let Some ( headers ) = headers_opt { for ( key , value ) in headers { let header_name = HeaderName :: from_str ( key ) . map_err ( | e | Error :: InvalidHeaderName { source : e } ) ? ; let header_value = HeaderValue :: from_str ( value ) . map_err ( | e | Error :: InvalidHeaderValue { source : e } ) ? ; header_map . insert ( header_name , header_value ) ; } } Ok ( Client :: < RequestCtx > :: Http { endpoint : endpoint . to_string ( ) , headers : header_map , } ) }
Takes the URL of a Warpgrapher service endpoint and returns a new ['Client'] initialized to
query that endpoint.
Takes the URL of a Warpgrapher service endpoint and returns a new [ ' Client ' ] initialized to query that endpoint .
endpoint
&str
headers_opt
Option<HashMap<&str, &str>>
endpoint
&str
headers_opt
Option<HashMap<&str, &str>>
examples
None
use warpgrapher::client;
None