refactor(backend): 重命名后端项目为 gym-manage-api,修改包名为 cn.novalon.gym.manage
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
详细检查请求头
|
||||
"""
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
import time
|
||||
import json
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(headless=True)
|
||||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
|
||||
# 监听网络请求
|
||||
def handle_request(request):
|
||||
if '/api/' in request.url and not request.url.endswith('.ts'):
|
||||
headers = request.headers
|
||||
print(f"\n{'='*80}")
|
||||
print(f"请求: {request.method} {request.url}")
|
||||
print(f"Headers:")
|
||||
for key, value in headers.items():
|
||||
if key.lower() in ['authorization', 'x-signature', 'x-timestamp', 'x-nonce']:
|
||||
print(f" {key}: {value[:50]}...")
|
||||
|
||||
def handle_response(response):
|
||||
if '/api/' in response.url and not response.url.endswith('.ts'):
|
||||
print(f"响应: {response.status} {response.url}")
|
||||
|
||||
page.on('request', handle_request)
|
||||
page.on('response', handle_response)
|
||||
|
||||
# 登录
|
||||
print("登录...")
|
||||
page.goto("http://localhost:3002/login")
|
||||
page.wait_for_load_state("networkidle")
|
||||
page.fill('input[placeholder="请输入用户名"]', 'admin')
|
||||
page.fill('input[placeholder="请输入密码"]', 'admin123')
|
||||
page.click('button:has-text("登录")')
|
||||
|
||||
# 等待Token
|
||||
for i in range(10):
|
||||
time.sleep(1)
|
||||
token = page.evaluate("localStorage.getItem('token')")
|
||||
if token:
|
||||
print(f"\n登录成功,Token: {token[:50]}...")
|
||||
break
|
||||
|
||||
# 访问dashboard
|
||||
print("\n\n访问Dashboard...")
|
||||
page.goto("http://localhost:3002/dashboard")
|
||||
page.wait_for_load_state("networkidle")
|
||||
time.sleep(3)
|
||||
|
||||
browser.close()
|
||||
Reference in New Issue
Block a user