File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,10 +101,12 @@ def main_config(binder):
101101
102102settings = inject .instance (Settings )
103103
104+ pkg_version = '2.0.0'
105+
104106app = 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():
138140async 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 )
143153async def http_exception_handler (request , exc ):
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ requests==2.28.0
66ring == 0.10.1
77uvicorn == 0.17.6
88gunicorn == 20.1.0
9- pytonlib == 0.0.67
9+ pytonlib == 0.0.68
1010inject == 4.3.1
Original file line number Diff line number Diff line change 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 = {},
You can’t perform that action at this time.
0 commit comments