Return `Last-Modified` header in response for compatibility with Live.js

未关闭
#7 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
clojure
领域
backend

调研方向

首先定位 babashka.http-server 中静态文件响应的处理逻辑及其 HEAD 请求路径。将所需行为与 ring.middleware.not-modified 进行比较,然后验证响应是否包含基于所提供文件的 Last-Modified,这样 Live.js 就不会依赖 Content-Length。

由索引模型根据 Issue 内容生成。

描述

I can contribute a PR here if desired. Just want to document the bug first.

Description:
babashka.http-server is used with Live.js to hot-reload changes to HTML, CSS, and JS. It uses HEAD requests to check the following headers: Etag, Last-Modified, Content-Length, and Content-Type.

Problem:
babashka.http-server doesn't return Last-Modified headers in the HTTP response. This means Live.js will fall back to using Content-Length to determine if there are new changes. It's possible for this to cause missed reloads since some changes (such as changing an integer in CSS) will result in the same Content-Length even though the content has changed.

When I use python3 -m http.server to serve the same files, I don't miss any changes even if the output file length is the same.

Solution:
Use ring.middleware.not-modified or something similar to add the Last-Modified to the HTTP responses.

主要语言
Clojure
星标
86
派生
12
平均合并
1 分钟
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Clojure Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。