emptygif
Bahasa: Bahasa Indonesia

Semua bahasa dan framework

plumber R

Snippet R untuk plumber yang menjawab request ke /pixel.gif dengan empty GIF, yang di-decode sekali saat startup.

plumber R

Instal
install.packages("plumber")
File
plumber.R
Jalankan
Rscript -e 'plumber::pr_run(plumber::pr("plumber.R"), port = 8080)'
# plumber.R
gif <- jsonlite::base64_dec("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")

#* @get /pixel.gif
#* @serializer contentType list(type = "image/gif")
function(res) {
  res$setHeader("Cache-Control", "no-store")
  gif
}

Kami telah menjalankan snippet ini dan membandingkan byte yang dikembalikannya.

Periksa

curl -sI http://localhost:8080/pixel.gif

Situs resmi: plumber