Skip to content

Commit

Permalink
I try so hard
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Jan 29, 2024
1 parent 24477a9 commit cc31c0d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions core/src/services/pcloud/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::fmt::Formatter;
use std::sync::Arc;

use async_trait::async_trait;
use http::StatusCode;
use http::{header, HeaderMap, StatusCode};
use log::debug;
use serde::Deserialize;

Expand Down Expand Up @@ -200,14 +200,15 @@ impl Builder for PcloudBuilder {
.with_context("service", Scheme::Pcloud)),
}?;

let client = if let Some(client) = self.http_client.take() {
client
} else {
HttpClient::new().map_err(|err| {
err.with_operation("Builder::build")
.with_context("service", Scheme::Pcloud)
})?
};
// Make sure all connection closed.
//
// Ref: https://docs.pcloud.com/protocols/http_json_protocol/single_connection.html
let client_builder = reqwest::ClientBuilder::new().default_headers({
let mut map = HeaderMap::default();
map.insert(header::CONNECTION, build_header_value("close")?);
map
});
let client = HttpClient::build(client_builder)?;

Ok(PcloudBackend {
core: Arc::new(PcloudCore {
Expand Down

0 comments on commit cc31c0d

Please sign in to comment.