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)