Roda Ruby
Snippet na Ruby don Roda da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.
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
Mun gudanar da wannan snippet kuma mun kwatanta bytes ɗin da ya mayar.
Duba shi
curl -sI http://localhost:8080/pixel.gif