From 3065cc8f9f583f37cec98abf79ad8b5837c20c5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E6=9C=97?= Date: Wed, 7 Jan 2026 14:48:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20test=5Fheader.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test_header.py | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 test_header.py diff --git a/test_header.py b/test_header.py deleted file mode 100644 index 69abb20..0000000 --- a/test_header.py +++ /dev/null @@ -1,31 +0,0 @@ -from flask import Flask, request, jsonify -import os -from dotenv import load_dotenv - -# 加载环境变量 -load_dotenv() - -app = Flask(__name__) -API_KEY = os.getenv('AI_API_KEY', '') - -@app.route('/test_headers', methods=['GET', 'POST']) -def test_headers(): - print("[DEBUG] All Request Headers:") - for key, value in request.headers.items(): - print(f" {key}: {value}") - - # 特别检查X-API-Key - api_key = request.headers.get('X-API-Key') - print(f"[DEBUG] X-API-Key specifically: '{api_key}'") - print(f"[DEBUG] Expected API Key: '{API_KEY}'") - print(f"[DEBUG] Match: {api_key == API_KEY}") - - return jsonify({ - 'received_headers': dict(request.headers), - 'api_key': api_key, - 'expected_api_key': API_KEY, - 'match': api_key == API_KEY - }) - -if __name__ == '__main__': - app.run(debug=True, port=5001)