Todos los lenguajes y frameworks
Roda Ruby
Un fragmento en Ruby para Roda que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.
Roda Ruby
require "roda"
class App < Roda
GIF = "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==".unpack1("m0").freeze
route do |r|
# Roda string matchers are written without the leading slash.
r.get "/pixel.gif".delete_prefix("/") do
response["content-type"] = "image/gif"
response["cache-control"] = "no-store"
GIF
end
end
end
run App.freeze.app
Ejecutamos este fragmento y comparamos los bytes que devolvió.
Comprobar
curl -sI http://localhost:8080/pixel.gif