Skip to content

Commit 567b23f

Browse files
Added X-API-Version header and updated tonlib (#184)
1 parent 28b0125 commit 567b23f

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

ton-http-api/pyTON/main.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ def main_config(binder):
101101

102102
settings = inject.instance(Settings)
103103

104+
pkg_version = '2.0.0'
105+
104106
app = FastAPI(
105107
title="TON HTTP API",
106108
description=description,
107-
version='2.0.0',
109+
version=pkg_version,
108110
docs_url='/',
109111
responses={
110112
422: {'description': 'Validation Error'},
@@ -138,6 +140,14 @@ async def startup():
138140
async def shutdown_event():
139141
await tonlib.shutdown()
140142

143+
144+
@app.middleware("http")
145+
async def add_process_time_header(request: Request, call_next):
146+
response = await call_next(request)
147+
response.headers["X-API-Version"] = pkg_version
148+
return response
149+
150+
141151
# Exception handlers
142152
@app.exception_handler(StarletteHTTPException)
143153
async def http_exception_handler(request, exc):

ton-http-api/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ requests==2.28.0
66
ring==0.10.1
77
uvicorn==0.17.6
88
gunicorn==20.1.0
9-
pytonlib==0.0.67
9+
pytonlib==0.0.68
1010
inject==4.3.1

ton-http-api/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
'ring==0.10.1',
2525
'uvicorn==0.17.6',
2626
'gunicorn==20.1.0',
27-
'pytonlib==0.0.67',
27+
'pytonlib==0.0.68',
2828
'inject==4.3.1'
2929
],
3030
package_data={},

0 commit comments

Comments
 (0)