mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 12:30:44 +00:00
修管理页 Content-Type(浏览器显示成一屏源码)
用户截图:打开 relay.xxmxxs.top/zhongzhuanzhan 看到的**不是页面, 而是整页 HTML 源码**。 根因:_send() 的 content_type 参数默认是 application/json, 我重做管理页时调它没传 text/html —— 浏览器按 JSON/纯文本处理, 就把 HTML 原样显示了。 ⚠ 更该反省的是:**我当时没发现。** 验证脚本只看了 HTTP 200 和字节数,两个都对,就以为没问题。 200 不等于页面能看 —— 响应头也得看。 顺手修的第二个问题: HEAD 请求一律返回 501 Unsupported method(没实现 do_HEAD)。 浏览器用 GET 所以页面照开,但 Cloudflare 健康检查、 很多监控/代理探测都用 HEAD,curl -I 也是。 补了 do_HEAD:按路径算出类型和长度,只回头不回体。 新增测试 _build/test_response_headers.py(9 项): * HEAD 各路径不能是 501 * 官网/管理页 Content-Type 必须是 text/html,不能是 json * favicon、产品截图必须是 image/* 并加进全量套件(阶段 3b6)。 验证:该测试 9/9 通过;全量套件 33 个阶段全部通过。
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
@@ -422,6 +422,17 @@ $stageOut = & python (Join-Path $root "_build\test_installer_cycle.py") 2>&1
|
||||
Show-Fails $stageOut
|
||||
Record "安装包完整周期" ($LASTEXITCODE -eq 0)
|
||||
|
||||
# ---------------------------------------------------------------- 3b6
|
||||
Banner "3b6/7 网页响应头(Content-Type / HEAD)"
|
||||
# 踩过的坑:重做管理页时 _send() 没传 content_type,
|
||||
# 默认成了 application/json —— 浏览器把整页 HTML 当纯文本显示,
|
||||
# 用户看到的是一屏源码。
|
||||
# 更糟的是当时没发现:只验了 HTTP 200 和字节数,两个都对。
|
||||
# **200 不等于页面能看。**
|
||||
$stageOut = & python (Join-Path $root "_build\test_response_headers.py") 2>&1
|
||||
Show-Fails $stageOut
|
||||
Record "网页响应头" ($LASTEXITCODE -eq 0)
|
||||
|
||||
# ---------------------------------------------------------------- 3c
|
||||
Banner "3c/7 中转管理端批量删除"
|
||||
$stageOut = & python (Join-Path $root "_tests\test_admin_batch_delete.py") 2>&1
|
||||
|
||||
Reference in New Issue
Block a user