From eba8cd9c4cecddade1b67c2b32fe444c7b9e94cd Mon Sep 17 00:00:00 2001 From: Jiri Vlasak Date: Thu, 20 May 2021 22:15:46 +0200 Subject: [PATCH] Add gzip to api for clients that support it --- CHANGELOG.rst | 1 + damn_server/api.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bba11ea..70e5b19 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,7 @@ Added - ``author`` to ``GET`` area(s) endpoints. - ``map oldest`` and ``review oldest`` commit types for area commit ``POST`` endpoint. +- Gzip for clients that support it. Changed ------- diff --git a/damn_server/api.py b/damn_server/api.py index 1417e86..bebe794 100644 --- a/damn_server/api.py +++ b/damn_server/api.py @@ -17,6 +17,7 @@ from asyncpg.exceptions import SerializationError from datetime import datetime from dateutil import parser as dt_parser from fastapi import Security +from fastapi.middleware.gzip import GZipMiddleware from fastapi.security import HTTPAuthorizationCredentials from fastapi.security import HTTPBearer from pydantic import conint @@ -72,6 +73,7 @@ app.add_middleware( allow_methods=["GET", "POST", "PUT"], allow_headers=["Authorization", "Content-Type"], ) +app.add_middleware(GZipMiddleware) osm = rauth.OAuth1Service( consumer_key=conf.OAUTH_CONSUMER_KEY, consumer_secret=conf.OAUTH_CONSUMER_SECRET, -- 2.34.4