The server now doesnt read files by itself, client must do it

This commit is contained in:
Igor Katson 2023-11-22 18:06:09 +00:00
parent 7d6ed06166
commit 707d4be631
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
5 changed files with 70 additions and 40 deletions

View file

@ -1,7 +1,10 @@
use anyhow::Context;
use serde::Deserialize;
use crate::{http_api::TorrentAddQueryParams, session::AddTorrentOptions};
use crate::{
http_api::TorrentAddQueryParams,
session::{AddTorrent, AddTorrentOptions},
};
#[derive(Clone)]
pub struct HttpApiClient {
@ -77,7 +80,7 @@ impl HttpApiClient {
pub async fn add_torrent(
&self,
torrent: &str,
torrent: AddTorrent<'_>,
opts: Option<AddTorrentOptions>,
) -> anyhow::Result<crate::http_api::ApiAddTorrentResponse> {
let opts = opts.unwrap_or_default();
@ -94,7 +97,7 @@ impl HttpApiClient {
let response = check_response(
self.client
.post(&url)
.body(torrent.to_owned())
.body(torrent.into_bytes())
.send()
.await?,
)