Skip to content

Commit 52f9b3f

Browse files
committed
feat: clean up unnecessary prints in GZipRequestMiddleware
1 parent 25e8d81 commit 52f9b3f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

open/text/embeddings/server/gzip.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Created by ChatGPT (GPT-3.5)
1+
# Created with the help of the ChatGPT (GPT-3.5)
22
# REF: https://chat.openai.com/share/4ab741e7-8059-4be1-b3da-46b8e78d98cc
33
# REF: https://gealber.com/gzip-middleware-fastapi
44
import gzip
5-
import json
65
from starlette.types import Message
76
from starlette.requests import Request
87
from starlette.responses import JSONResponse
@@ -15,7 +14,7 @@ async def set_body(self, request: Request):
1514
content_encoding = request.headers.get('Content-Encoding', '').lower()
1615
print("content_encoding", content_encoding)
1716
if 'gzip' in content_encoding:
18-
print("receive_", receive_)
17+
# print("receive_", receive_)
1918

2019
try:
2120
content_length = int(
@@ -27,12 +26,10 @@ async def set_body(self, request: Request):
2726
status_code=400,
2827
)
2928
json_byte_string = gzip.decompress(body)
30-
# json_string = json_byte_string.decode('utf-8')
31-
# json_object = json.dumps(json_string)
3229
receive_['body'] = json_byte_string
3330
print("content_length", content_length)
34-
print("body", body)
35-
print("receive_['body']", receive_['body'])
31+
# print("body", body)
32+
print("gzip decompressed body:", receive_['body'])
3633
except ValueError:
3734
return JSONResponse(
3835
content={"error": "Invalid Content-Length header"},

0 commit comments

Comments
 (0)