pub(crate) async fn send(
    client: &dyn HttpClient,
    endpoint: &Uri,
    items: Vec<Envelope>,
) -> Result<(), Error> {
    let payload = serialize_request_body(items)?;
    let request = Request::post(endpoint)
        .header(http::header::CONTENT_TYPE, "application/json")
        .header(http::header::CONTENT_ENCODING, "gzip")
        .body(payload)
        .expect("request should be valid");

    // TODO Implement retries
    let response = client
        .send(request)
        .await
        .map_err(Error::UploadConnection)?;
    handle_response(response)
}
/// Sends a telemetry items to the server.
Sends a telemetry items to the server.
Sends a telemetry items to the server .
pub(crate) async fn send(
    client: &dyn HttpClient,
    endpoint: &Uri,
    items: Vec<Envelope>,
) -> Result<(), Error> {
    let payload = serialize_request_body(items)?;
    let request = Request::post(endpoint)
        .header(http::header::CONTENT_TYPE, "application/json")
        .header(http::header::CONTENT_ENCODING, "gzip")
        .body(payload)
        .expect("request should be valid");
    // TODO Implement retries
    let response = client
        .send(request)
        .await
        .map_err(Error::UploadConnection)?;
    handle_response(response)
}
pub ( crate ) async fn send ( client : & dyn HttpClient , endpoint : & Uri , items : Vec < Envelope > , ) -> Result < ( ) , Error > { let payload = serialize_request_body ( items ) ? ; let request = Request :: post ( endpoint ) . header ( http :: header :: CONTENT_TYPE , " " ) . header ( http :: header :: CONTENT_ENCODING , " " ) . body ( payload ) . expect ( " " ) ; // TODO Implement retries let response = client . send ( request ) . await . map_err ( Error :: UploadConnection ) ? ; handle_response ( response ) }
Sends a telemetry items to the server.
Sends a telemetry items to the server .
client
&dyn HttpClient
endpoint
&Uri
items
Vec<Envelope>
client
&dyn HttpClient
endpoint
&Uri
items
Vec<Envelope>