Skip to content

Commit 00bfc65

Browse files
committed
fix: update keyword handling and enhance caching headers for search responses
1 parent 5eafa09 commit 00bfc65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def keyword(request: Request):
161161
_keyword = data.get('keyword')
162162
if _keyword == '' or _keyword == 'your keyword':
163163
return JSONResponse({}, status_code=200)
164-
if _keyword == 'Yuki Forever💗':
164+
if _keyword == 'ping':
165165
return JSONResponse(
166166
{"code": 0, "data": [{"type": "vod", "words": ["pong"]}],
167167
"msg": "ok"}, status_code=200, headers={"X-Info": "Success"})
@@ -178,7 +178,7 @@ async def keyword(request: Request):
178178
logging.error("Error: " + str(e), stack_info=True)
179179
return JSONResponse({"error": str(e)}, status_code=501, headers={"X-Error": str(e)})
180180
try:
181-
return JSONResponse(data)
181+
return JSONResponse(data, status_code=200, headers={"X-Cache": "HIT" if "msg" in data and data["msg"] == "cached" else "MISS"})
182182
except:
183183
return JSONResponse(json.loads(data), status_code=200, headers={"X-Cache": "MISS"})
184184

0 commit comments

Comments
 (0)