mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge branch 'dev-3.x' into dev-3.x-api-5.0
# Conflicts: # tests/test_api/test_client/test_session/test_aiohttp_session.py
This commit is contained in:
commit
c8991a5723
2 changed files with 4 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ from aiohttp import BasicAuth, ClientSession, FormData, TCPConnector
|
||||||
|
|
||||||
from aiogram.methods import Request, TelegramMethod
|
from aiogram.methods import Request, TelegramMethod
|
||||||
|
|
||||||
from .base import BaseSession
|
from .base import BaseSession, UNSET
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from ..bot import Bot
|
from ..bot import Bot
|
||||||
|
|
@ -121,7 +121,7 @@ class AiohttpSession(BaseSession):
|
||||||
def build_form_data(self, request: Request) -> FormData:
|
def build_form_data(self, request: Request) -> FormData:
|
||||||
form = FormData(quote_fields=False)
|
form = FormData(quote_fields=False)
|
||||||
for key, value in request.data.items():
|
for key, value in request.data.items():
|
||||||
if value is None:
|
if value is None or value is UNSET:
|
||||||
continue
|
continue
|
||||||
form.add_field(key, self.prepare_value(value))
|
form.add_field(key, self.prepare_value(value))
|
||||||
if request.files:
|
if request.files:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from aiogram import Bot
|
||||||
from aiogram.client.session import aiohttp
|
from aiogram.client.session import aiohttp
|
||||||
from aiogram.client.session.aiohttp import AiohttpSession
|
from aiogram.client.session.aiohttp import AiohttpSession
|
||||||
from aiogram.methods import Request, TelegramMethod
|
from aiogram.methods import Request, TelegramMethod
|
||||||
from aiogram.types import InputFile
|
from aiogram.types import InputFile, UNSET
|
||||||
from tests.mocked_bot import MockedBot
|
from tests.mocked_bot import MockedBot
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -118,6 +118,7 @@ class TestAiohttpSession:
|
||||||
"str": "value",
|
"str": "value",
|
||||||
"int": 42,
|
"int": 42,
|
||||||
"bool": True,
|
"bool": True,
|
||||||
|
"unset": UNSET,
|
||||||
"null": None,
|
"null": None,
|
||||||
"list": ["foo"],
|
"list": ["foo"],
|
||||||
"dict": {"bar": "baz"},
|
"dict": {"bar": "baz"},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue