Roda Ruby
Roda için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir Ruby örneği.
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
Bu örneği çalıştırıp döndürdüğü baytları karşılaştırdık.
Kontrol et
curl -sI http://localhost:8080/pixel.gif