Roda Ruby
Roda માટે Ruby સ્નિપેટ, જે /pixel.gif પરની રિક્વેસ્ટનો જવાબ empty GIF થી આપે છે. GIF સ્ટાર્ટઅપ વખતે એક જ વાર ડિકોડ થાય છે.
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
અમે આ સ્નિપેટ ચલાવ્યો અને તેણે પરત કરેલા બાઇટની સરખામણી કરી.
ચકાસો
curl -sI http://localhost:8080/pixel.gif