fix(aiohttp-session): respect UNSET sentinel

check if value is `UNSET` while building http request.
This commit is contained in:
Martin Winks 2020-07-21 05:13:10 +04:00 committed by GitHub
parent 6f53f15577
commit 0e9623a118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,7 @@ from aiohttp import BasicAuth, ClientSession, FormData, TCPConnector
from aiogram.api.methods import Request, TelegramMethod
from .base import BaseSession
from .base import BaseSession, UNSET
if TYPE_CHECKING: # pragma: no cover
from ..bot import Bot
@ -121,7 +121,7 @@ class AiohttpSession(BaseSession):
def build_form_data(self, request: Request) -> FormData:
form = FormData(quote_fields=False)
for key, value in request.data.items():
if value is None:
if value is None or value is UNSET:
continue
form.add_field(key, self.prepare_value(value))
if request.files: