mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-08 19:33:53 +01:00
Add 'Connection: keep-alive' to net::download
This commit is contained in:
parent
f5941973db
commit
981e79e1c7
1 changed files with 3 additions and 0 deletions
|
@ -4,6 +4,7 @@ use tokio::io::{AsyncWrite, AsyncWriteExt};
|
|||
use crate::errors::DownloadError;
|
||||
|
||||
use super::TELEGRAM_API_URL;
|
||||
use reqwest::header::CONNECTION;
|
||||
|
||||
pub async fn download_file<D>(
|
||||
client: &Client,
|
||||
|
@ -16,6 +17,7 @@ where
|
|||
{
|
||||
let mut res = client
|
||||
.get(&super::file_url(TELEGRAM_API_URL, token, path))
|
||||
.header(CONNECTION, "keep-alive")
|
||||
.send()
|
||||
.await?
|
||||
.error_for_status()?;
|
||||
|
@ -35,6 +37,7 @@ pub async fn download_file_stream(
|
|||
) -> Result<impl Stream<Item = reqwest::Result<Bytes>>, reqwest::Error> {
|
||||
let res = client
|
||||
.get(&super::file_url(TELEGRAM_API_URL, token, path))
|
||||
.header(CONNECTION, "keep-alive")
|
||||
.send()
|
||||
.await?
|
||||
.error_for_status()?;
|
||||
|
|
Loading…
Reference in a new issue