emptygif
Dil: Türkçe

Tüm diller ve framework'ler

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

Kurulum
gem install roda rackup puma
Dosya
config.ru
Çalıştır
rackup -p 8080
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

Resmî site: Roda

Ruby için daha fazlası