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

Aberta
#7 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
clojure
Domínio
backend

Direção de pesquisa

Comece localizando o tratamento de respostas de arquivos estáticos e o caminho de requisições HEAD correspondente em babashka.http-server. Compare o comportamento necessário com ring.middleware.not-modified e, em seguida, verifique se as respostas incluem Last-Modified com base no arquivo servido, para que o Live.js não dependa de Content-Length.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Clojure
Estrelas
86
Forks
12
Merge médio
1min
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Issues semelhantes

Mais issues de Clojure

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.