Skip to content

Commit a9f3b73

Browse files
authored
add GZIP support for responses > 1000bytes (#294)
* add GZIP support for responses > 1000bytes * increment version
1 parent 81abb26 commit a9f3b73

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak.
55
"""
66
# See PEP396.
7-
__version__ = "2.0.1"
7+
__version__ = "2.0.3"

app/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import uvicorn
99
from fastapi import FastAPI, Request, Response
1010
from fastapi.middleware.cors import CORSMiddleware
11+
from fastapi.middleware.gzip import GZipMiddleware
1112
from fastapi.responses import JSONResponse
1213

1314
from .data import data_source
@@ -26,7 +27,7 @@
2627
"API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak."
2728
" Project page: https://github.com/ExpDev07/coronavirus-tracker-api."
2829
),
29-
version="2.0.2",
30+
version="2.0.3",
3031
docs_url="/",
3132
redoc_url="/docs",
3233
on_startup=[setup_client_session],
@@ -41,6 +42,7 @@
4142
APP.add_middleware(
4243
CORSMiddleware, allow_credentials=True, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"],
4344
)
45+
APP.add_middleware(GZipMiddleware, minimum_size=1000)
4446

4547

4648
@APP.middleware("http")

0 commit comments

Comments
 (0)